Total Complexity | 4 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | class KeyValue implements ContainerInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var array<string, mixed> |
||
14 | */ |
||
15 | private $values; |
||
16 | |||
17 | /** |
||
18 | * @param array<string, mixed> $values |
||
19 | */ |
||
20 | 24 | public function __construct(array $values) |
|
21 | { |
||
22 | 24 | $this->values = $values; |
|
23 | 24 | } |
|
24 | |||
25 | 15 | public function get($id) |
|
26 | { |
||
27 | 15 | if (!$this->has($id)) { |
|
28 | 3 | throw new NotFound($id); |
|
29 | } |
||
30 | 12 | return $this->values[$id]; |
|
31 | } |
||
32 | |||
33 | 18 | public function has($id): bool |
|
36 | } |
||
37 | } |
||
38 |