1 | <?php |
||
28 | class NamespaceCrawler extends NodeVisitorAbstract |
||
29 | { |
||
30 | /** |
||
31 | * @var Name[] List of namespaces to test for each undefined name |
||
32 | */ |
||
33 | private $search = []; |
||
34 | |||
35 | /** |
||
36 | * @var Name[] List of namespaces that will be allowed even if not defined |
||
37 | */ |
||
38 | private $whitelist = []; |
||
39 | |||
40 | /** |
||
41 | * Search namespaces for definied classes |
||
42 | * |
||
43 | * @param string[] $search List of namespaces to test for each undefined name |
||
44 | * @param string[] $whitelist namespaces that will be allowed even if not defined |
||
45 | */ |
||
46 | public function __construct(array $search, array $whitelist = array()) |
||
56 | |||
57 | /** |
||
58 | * Resolve unexisting names by searching specified namespaces |
||
59 | * |
||
60 | * @throws RuntimeException If name can not be resolved |
||
61 | */ |
||
62 | public function leaveNode(Node $node) |
||
81 | |||
82 | /** |
||
83 | * Check if name is whitelisted |
||
84 | * |
||
85 | * @param Name $name |
||
86 | * @return bool |
||
87 | */ |
||
88 | public function isWhitelisted(Name $name): bool |
||
98 | } |
||
99 |