1 | <?php |
||
8 | class ReflectionFile |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * The file that is reflected. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $reflectedFilePath; |
||
17 | |||
18 | /** |
||
19 | * The reflected file content. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $reflectedFileContent; |
||
24 | |||
25 | /** |
||
26 | * The namespaces in the file. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $namespaces = array(); |
||
31 | |||
32 | /** |
||
33 | * The use statements in the file. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $uses = array(); |
||
38 | |||
39 | /** |
||
40 | * Array of objects found in the file. |
||
41 | * |
||
42 | * @var \Reflector[] |
||
43 | */ |
||
44 | protected $objects = array(); |
||
45 | |||
46 | /** |
||
47 | * Constructor. |
||
48 | * |
||
49 | * @param string $reflectedFilePath The file path to reflect. |
||
50 | */ |
||
51 | 12 | public function __construct($reflectedFilePath) |
|
63 | |||
64 | /** |
||
65 | * Do the reflection to gather data. |
||
66 | */ |
||
67 | 12 | private function reflect() |
|
127 | |||
128 | /** |
||
129 | * Get the token value for the next token of type. |
||
130 | * |
||
131 | * @param array $tokens The tokens array. |
||
132 | * @param array $take The tokens to look for. |
||
133 | * @return null|string |
||
134 | */ |
||
135 | 12 | private function fetch(& $tokens, array $take) |
|
150 | |||
151 | /** |
||
152 | * Get the file path of the reflected file. |
||
153 | * |
||
154 | * @return string |
||
155 | */ |
||
156 | public function getFilePath() |
||
160 | |||
161 | /** |
||
162 | * Get the namespaces defined in the file. |
||
163 | * |
||
164 | * @return array |
||
165 | */ |
||
166 | 9 | public function getNamespaces() |
|
170 | |||
171 | /** |
||
172 | * Get the use statements in the file. |
||
173 | * |
||
174 | * @return array |
||
175 | */ |
||
176 | 6 | public function getUses() |
|
180 | |||
181 | /** |
||
182 | * Get the objects found in the file. |
||
183 | * |
||
184 | * @return \Reflector[] |
||
185 | */ |
||
186 | 3 | public function getObjects() |
|
190 | |||
191 | /** |
||
192 | * Resolve an alias for an FQN. |
||
193 | * |
||
194 | * @param string $fqn The fully qualified name to get the alias for. |
||
195 | * @return string |
||
196 | */ |
||
197 | 3 | public function resolveFqnToAlias($fqn) |
|
210 | } |
||
211 |