1 | <?php |
||
21 | class ReflectionFile |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * Name of the file for reflectino |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $fileName; |
||
30 | |||
31 | /** |
||
32 | * List of namespaces in the file |
||
33 | * |
||
34 | * @var ReflectionFileNamespace[]|array |
||
35 | */ |
||
36 | protected $fileNamespaces; |
||
37 | |||
38 | /** |
||
39 | * Top-level nodes for the file |
||
40 | * |
||
41 | * @var Node[] |
||
42 | */ |
||
43 | private $topLevelNodes; |
||
44 | |||
45 | /** |
||
46 | * ReflectionFile constructor. |
||
47 | * |
||
48 | * @param string $fileName Name of the file to reflect |
||
49 | * @param null|array|Node[] $topLevelNodes Optional corresponding list of AST nodes for that file |
||
50 | */ |
||
51 | 137 | public function __construct($fileName, $topLevelNodes = null) |
|
56 | |||
57 | /** |
||
58 | * Returns a namespace from the file or false if no such a namespace |
||
59 | * |
||
60 | * @param string $namespaceName |
||
61 | * |
||
62 | * @return bool|ReflectionFileNamespace |
||
63 | */ |
||
64 | 130 | public function getFileNamespace($namespaceName) |
|
72 | |||
73 | /** |
||
74 | * Gets the list of namespaces in the file |
||
75 | * |
||
76 | * @return array|ReflectionFileNamespace[] |
||
77 | */ |
||
78 | 134 | public function getFileNamespaces() |
|
86 | |||
87 | /** |
||
88 | * Returns the name of current reflected file |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | 1 | public function getName() |
|
96 | |||
97 | /** |
||
98 | * Returns the presence of namespace in the file |
||
99 | * |
||
100 | * @param string $namespaceName Namespace to check |
||
101 | * |
||
102 | * @return bool |
||
103 | */ |
||
104 | 131 | public function hasFileNamespace($namespaceName) |
|
110 | |||
111 | /** |
||
112 | * Searches for file namespaces in the given AST |
||
113 | * |
||
114 | * @return array|ReflectionFileNamespace[] |
||
115 | */ |
||
116 | 134 | private function findFileNamespaces() |
|
141 | } |
||
142 |