Total Complexity | 9 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
14 | final class Grammar implements Container |
||
15 | { |
||
16 | public function __construct( |
||
20 | |||
21 | public static function container(): self |
||
22 | { |
||
23 | return new self(Eager::container(), Lazy::container()); |
||
24 | } |
||
25 | |||
26 | public static function with(LazyContainer $lazy): self |
||
27 | { |
||
28 | return new self(Eager::container(), $lazy); |
||
29 | } |
||
30 | |||
31 | public function offsetGet($name): Parser |
||
32 | { |
||
33 | return $this->eager[$name] ?? $this->lazy[$name]; |
||
34 | } |
||
35 | |||
36 | public function offsetSet($name, $parser): void |
||
39 | } |
||
40 | |||
41 | public function offsetExists($name): bool |
||
44 | } |
||
45 | |||
46 | public function offsetUnset($name): void |
||
49 | } |
||
50 | |||
51 | public function lazy(string $name, Parser $parser): void |
||
54 | } |
||
55 | } |
||
56 |