1 | <?php |
||
11 | class SymbolTable implements Countable |
||
12 | { |
||
13 | /** |
||
14 | * @var Variable[] |
||
15 | */ |
||
16 | protected $variables = []; |
||
17 | |||
18 | /** |
||
19 | * @param Variable $variable |
||
20 | */ |
||
21 | 1 | public function add(Variable $variable) |
|
22 | { |
||
23 | 1 | $this->variables[$variable->getName()] = $variable; |
|
24 | 1 | } |
|
25 | |||
26 | /** |
||
27 | * @param string $name |
||
28 | * @return Variable|null |
||
29 | */ |
||
30 | public function get($name) |
||
38 | |||
39 | /** |
||
40 | * @return int |
||
41 | */ |
||
42 | public function count() |
||
46 | |||
47 | /** |
||
48 | * Clear symbol table |
||
49 | */ |
||
50 | public function clear() |
||
54 | |||
55 | /** |
||
56 | * @return Variable[] |
||
57 | */ |
||
58 | 1 | public function getVariables() |
|
62 | } |
||
63 |