| Total Complexity | 10 |
| Total Lines | 67 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | final class Simple implements Dictionary |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | private $name; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var array<mixed, E> |
||
| 23 | */ |
||
| 24 | private $values = []; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param array<mixed, E> $values |
||
| 28 | */ |
||
| 29 | 20 | public function __construct(string $name, array $values) |
|
| 30 | { |
||
| 31 | 20 | $this->name = $name; |
|
| 32 | 20 | $this->values = $values; |
|
| 33 | 20 | } |
|
| 34 | |||
| 35 | 13 | public function getName(): string |
|
| 36 | { |
||
| 37 | 13 | return $this->name; |
|
| 38 | } |
||
| 39 | |||
| 40 | 12 | public function getValues(): array |
|
| 41 | { |
||
| 42 | 12 | return $this->values; |
|
| 43 | } |
||
| 44 | |||
| 45 | 8 | public function getKeys(): array |
|
| 46 | { |
||
| 47 | 8 | return array_keys($this->values); |
|
| 48 | } |
||
| 49 | |||
| 50 | 1 | public function offsetExists($offset): bool |
|
| 53 | } |
||
| 54 | |||
| 55 | 2 | public function offsetGet($offset) |
|
| 56 | { |
||
| 57 | 2 | return $this->values[$offset]; |
|
| 58 | } |
||
| 59 | |||
| 60 | 1 | public function offsetSet($offset, $value): void |
|
| 61 | { |
||
| 62 | 1 | $this->values[$offset] = $value; |
|
| 63 | 1 | } |
|
| 64 | |||
| 65 | 1 | public function offsetUnset($offset): void |
|
| 66 | { |
||
| 67 | 1 | unset($this->values[$offset]); |
|
| 68 | 1 | } |
|
| 69 | |||
| 70 | /** |
||
| 71 | * @return Generator<mixed> |
||
| 72 | */ |
||
| 73 | 1 | public function getIterator(): Generator |
|
| 74 | { |
||
| 75 | 1 | yield from $this->values; |
|
| 76 | 1 | } |
|
| 77 | |||
| 78 | 2 | public function count(): int |
|
| 81 | } |
||
| 82 | } |
||
| 83 |