| Total Complexity | 6 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | trait HashTableFacadeTrait |
||
| 22 | { |
||
| 23 | use ValueFactoryFacadeTrait; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var HashTableInterface |
||
| 27 | */ |
||
| 28 | protected HashTableInterface $hash; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return void |
||
| 32 | */ |
||
| 33 | private function bootHashTableFacadeTrait(): void |
||
| 34 | { |
||
| 35 | $this->bootValueFactoryFacadeTrait(); |
||
| 36 | |||
| 37 | $this->hash = new HashTable($this->factory); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @return HashTableInterface |
||
| 42 | */ |
||
| 43 | public function getVariables(): HashTableInterface |
||
| 44 | { |
||
| 45 | return $this->hash; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param string $name |
||
| 50 | * @param $value |
||
| 51 | * @return $this |
||
| 52 | */ |
||
| 53 | public function addVariable(string $name, $value): self |
||
| 54 | { |
||
| 55 | $this->hash->add($name, $value); |
||
| 56 | |||
| 57 | return $this; |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param string $name |
||
| 62 | * @return ValueInterface|null |
||
| 63 | */ |
||
| 64 | public function findVariable(string $name): ?ValueInterface |
||
| 65 | { |
||
| 66 | if ($this->hash->has($name)) { |
||
| 67 | return $this->hash->get($name); |
||
| 68 | } |
||
| 69 | |||
| 70 | return null; |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @param string $name |
||
| 75 | * @return bool |
||
| 76 | */ |
||
| 77 | public function hasVariable(string $name): bool |
||
| 80 | } |
||
| 81 | } |
||
| 82 |