Total Complexity | 8 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
15 | final class Limited implements LazyContainer |
||
16 | { |
||
17 | private array $cache = []; |
||
18 | |||
19 | public function __construct( |
||
20 | private LazyContainer $container |
||
21 | ) {} |
||
22 | |||
23 | public static function recursion(LazyContainer $container): LazyContainer |
||
26 | } |
||
27 | |||
28 | public function offsetGet($name): Parser |
||
29 | { |
||
30 | if (!isset($this->cache[$name])) { |
||
31 | $this->cache[$name] = new Limit($this->container[$name]); |
||
32 | } |
||
33 | return $this->cache[$name]; |
||
34 | } |
||
35 | |||
36 | public function offsetSet($name, $parser): void |
||
37 | { |
||
38 | $this->container[$name] = $parser; |
||
39 | } |
||
40 | |||
41 | public function offsetExists($name): bool |
||
42 | { |
||
43 | return isset($this->container[$name]); |
||
44 | } |
||
45 | |||
46 | public function offsetUnset($name): void |
||
47 | { |
||
48 | unset($this->container[$name]); |
||
49 | } |
||
50 | |||
51 | public function factory(string $name): Closure |
||
54 | } |
||
55 | } |
||
56 |