forked from llaville/php-reflect
-
Notifications
You must be signed in to change notification settings - Fork 1
/
scanFileWithOptions.php
46 lines (40 loc) · 1.2 KB
/
scanFileWithOptions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* Example that scan a simple file (PEAR core file)
* and return list of PEAR_Error methods (with limited details)
*
* PHP version 5
*
* @category PHP
* @package PHP_Reflect
* @author Laurent Laville <[email protected]>
* @license https://www.opensource.org/licenses/bsd-license.php BSD
* @version GIT: $Id$
* @link https://php5.laurent-laville.org/reflect/
* @since File available since Release 1.0.0
*/
require_once 'Bartlett/PHP/Reflect/Autoload.php';
$source = '/path/to/PEAR-1.9.2/PEAR.php';
try {
$options = array(
'properties' => array(
'interface' => array(
'keywords', 'parent', 'methods'
),
'class' => array(
'keywords', 'parent', 'methods', 'interfaces', 'package'
),
'function' => array(
'keywords', 'signature'
),
)
);
$reflect = new PHP_Reflect($options);
$reflect->scan($source);
$classes = $reflect->getClasses();
print_r($classes['\\']['PEAR_Error']['docblock']);
print_r($classes['\\']['PEAR_Error']['methods']);
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . PHP_EOL;
}
?>