Total Complexity | 5 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | final class SafeArrayIterator implements ArrayAccess |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * Ctor. |
||
20 | * |
||
21 | * @phpstan-param array<TKey, TValue> $stored |
||
22 | * @param array<mixed, mixed> $stored array for stored values. |
||
23 | */ |
||
24 | public function __construct( |
||
25 | /** |
||
26 | * Array for stored values. |
||
27 | * |
||
28 | * @phpstan-var array<TKey, TValue> |
||
29 | * @var array |
||
30 | */ |
||
31 | private array $stored = [] |
||
32 | ) { |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * {@inheritDoc} |
||
37 | * @phpstan-param TKey $offset |
||
38 | * @phpstan-param TValue $value |
||
39 | */ |
||
40 | public function offsetSet(mixed $offset, mixed $value): void |
||
41 | { |
||
42 | $this->stored[$offset] = $value; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * {@inheritDoc} |
||
47 | * @phpstan-param TKey $offset |
||
48 | */ |
||
49 | public function offsetGet(mixed $offset): mixed |
||
50 | { |
||
51 | return $this->stored[$offset]; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * {@inheritDoc} |
||
56 | * @phpstan-param TKey $offset |
||
57 | */ |
||
58 | public function offsetExists(mixed $offset): bool |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * {@inheritDoc} |
||
65 | * @phpstan-param TKey $offset |
||
66 | */ |
||
67 | public function offsetUnset(mixed $offset): void |
||
70 | } |
||
71 | } |
||
72 |