1 | <?php |
||
11 | class Registry |
||
12 | { |
||
13 | /** |
||
14 | * A list of contexts with all the nodes that were found in the source code. |
||
15 | * |
||
16 | * @var array |
||
17 | */ |
||
18 | public $data; // TODO: Convert to protected <[email protected]> |
||
19 | /** |
||
20 | * A list of contexts with all the file path leading |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | public $mapping; // TODO: Convert to protected <[email protected]> |
||
25 | /** |
||
26 | * |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $currentFile; |
||
31 | |||
32 | 41 | public function __construct() |
|
33 | { |
||
34 | $contexts = [ |
||
35 | 41 | 'class' => [], |
|
36 | 'function' => [], |
||
37 | 'interface' => [], |
||
38 | 'trait' => [], |
||
39 | ]; |
||
40 | |||
41 | 41 | $this->data = $contexts; |
|
42 | 41 | $this->mapping = $contexts; |
|
43 | 41 | } |
|
44 | |||
45 | /** |
||
46 | * @param \PhpParser\Node\Stmt\Class_ $class |
||
47 | */ |
||
48 | 6 | public function addClass(Class_ $class) |
|
52 | |||
53 | /** |
||
54 | * @param \PhpParser\Node\Stmt\Function_ $function |
||
55 | */ |
||
56 | 21 | public function addFunction(Function_ $function) |
|
60 | |||
61 | /** |
||
62 | * @param \PhpParser\Node\Stmt\Interface_ $interface |
||
63 | */ |
||
64 | 6 | public function addInterface(Interface_ $interface) |
|
68 | |||
69 | /** |
||
70 | * @param \PhpParser\Node\Stmt\Trait_ $trait |
||
71 | */ |
||
72 | 6 | public function addTrait(Trait_ $trait) |
|
76 | |||
77 | /** |
||
78 | * @param string $context |
||
79 | * @param Stmt $node |
||
80 | */ |
||
81 | 39 | protected function addNode($context, Stmt $node) |
|
87 | |||
88 | /** |
||
89 | * @param Stmt $node |
||
90 | * @return string |
||
91 | */ |
||
92 | 39 | protected function fullyQualifiedName(Stmt $node) |
|
96 | |||
97 | /** |
||
98 | * @param string $file |
||
99 | */ |
||
100 | 5 | public function setCurrentFile($file) |
|
104 | |||
105 | /** |
||
106 | * @return string |
||
107 | */ |
||
108 | 39 | public function getCurrentFile() |
|
112 | } |
||
113 |