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