Total Complexity | 5 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class RegistryTag |
||
8 | { |
||
9 | /** |
||
10 | * @param non-empty-string $id |
||
|
|||
11 | * */ |
||
12 | 3 | public function __construct( |
|
13 | readonly protected string $tag, |
||
14 | readonly protected Registry $registry, |
||
15 | ) { |
||
16 | 3 | } |
|
17 | |||
18 | 1 | public function has(string $id): mixed |
|
19 | { |
||
20 | 1 | return $this->registry->hasTagged($this->tag, $id); |
|
21 | } |
||
22 | |||
23 | 2 | public function entry(string $id): RegistryEntry |
|
24 | { |
||
25 | 2 | return $this->registry->taggedEntry($this->tag, $id); |
|
26 | } |
||
27 | |||
28 | 2 | public function get(string $id): mixed |
|
29 | { |
||
30 | 2 | return $this->registry->getTagged($this->tag, $id); |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param non-empty-string $id |
||
35 | */ |
||
36 | 2 | public function add(string $id, mixed $value = null): RegistryEntry |
|
39 | } |
||
40 | } |
||
41 |