1 | <?php |
||
29 | class ReflectionEngine |
||
30 | { |
||
31 | /** |
||
32 | * @var null|LocatorInterface |
||
33 | */ |
||
34 | protected static $locator = null; |
||
35 | |||
36 | /** |
||
37 | * @var array|Node[] |
||
38 | */ |
||
39 | protected static $parsedFiles = array(); |
||
40 | |||
41 | /** |
||
42 | * @var null|integer |
||
43 | */ |
||
44 | protected static $maximumCachedFiles; |
||
45 | |||
46 | /** |
||
47 | * @var null|Parser |
||
48 | */ |
||
49 | protected static $parser = null; |
||
50 | |||
51 | /** |
||
52 | * @var null|NodeTraverser |
||
53 | */ |
||
54 | protected static $traverser = null; |
||
55 | |||
56 | /** |
||
57 | * @var null|Lexer |
||
58 | */ |
||
59 | protected static $lexer = null; |
||
60 | |||
61 | private function __construct() {} |
||
62 | |||
63 | 1 | public static function init(LocatorInterface $locator) |
|
83 | |||
84 | /** |
||
85 | * Limits number of files, that can be cached at any given moment |
||
86 | * |
||
87 | * @param integer $newLimit New limit |
||
88 | * |
||
89 | * @return void |
||
90 | */ |
||
91 | public static function setMaximumCachedFiles($newLimit) |
||
98 | |||
99 | /** |
||
100 | * Locates a file name for class |
||
101 | * |
||
102 | * @param string $fullClassName Full name of the class |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | 20 | public static function locateClassFile($fullClassName) |
|
124 | |||
125 | /** |
||
126 | * Tries to parse a class by name using LocatorInterface |
||
127 | * |
||
128 | * @param string $fullClassName Class name to load |
||
129 | * |
||
130 | * @return ClassLike |
||
131 | */ |
||
132 | 20 | public static function parseClass($fullClassName) |
|
153 | |||
154 | /** |
||
155 | * Parses class method |
||
156 | * |
||
157 | * @param string $fullClassName Name of the class |
||
158 | * @param string $methodName Name of the method |
||
159 | * |
||
160 | * @return ClassMethod |
||
161 | */ |
||
162 | public static function parseClassMethod($fullClassName, $methodName) |
||
175 | |||
176 | /** |
||
177 | * Parses class property |
||
178 | * |
||
179 | * @param string $fullClassName Name of the class |
||
180 | * @param string $propertyName Name of the property |
||
181 | * |
||
182 | * @return array Pair of [Property and PropertyProperty] nodes |
||
183 | */ |
||
184 | 1 | public static function parseClassProperty($fullClassName, $propertyName) |
|
201 | |||
202 | /** |
||
203 | * Parses a file and returns an AST for it |
||
204 | * |
||
205 | * @param string $fileName Name of the file |
||
206 | * @param string|null $fileContent Optional content of the file |
||
207 | * |
||
208 | * @return \PhpParser\Node[] |
||
209 | */ |
||
210 | 3047 | public static function parseFile($fileName, $fileContent = null) |
|
231 | |||
232 | /** |
||
233 | * Parses a file namespace and returns an AST for it |
||
234 | * |
||
235 | * @param string $fileName Name of the file |
||
236 | * @param string $namespaceName Namespace name |
||
237 | * |
||
238 | * @return Namespace_ |
||
239 | * @throws ReflectionException |
||
240 | */ |
||
241 | 35 | public static function parseFileNamespace($fileName, $namespaceName) |
|
257 | |||
258 | } |
||
259 |