Total Complexity | 6 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
19 | class FilterArray extends IteratorIterator implements Iterator |
||
20 | { |
||
21 | /** |
||
22 | * FilterArray constructor. |
||
23 | * @param FilterInterface[]|null[] ...$filters |
||
24 | */ |
||
25 | 7 | public function __construct(?FilterInterface ...$filters) |
|
26 | { |
||
27 | 7 | parent::__construct(new ArrayIterator($filters)); |
|
28 | 7 | } |
|
29 | |||
30 | /** |
||
31 | * @return FilterInterface |
||
32 | */ |
||
33 | 3 | public function current(): FilterInterface |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param FilterInterface $filter |
||
40 | */ |
||
41 | 2 | public function add(FilterInterface $filter): void |
|
42 | { |
||
43 | 2 | $this->getInnerIterator()->append($filter); |
|
|
|||
44 | 2 | } |
|
45 | |||
46 | /** |
||
47 | * @param int $key |
||
48 | * @param FilterInterface $filter |
||
49 | */ |
||
50 | 1 | public function set(int $key, FilterInterface $filter): void |
|
51 | { |
||
52 | 1 | $this->getInnerIterator()->offsetSet($key, $filter); |
|
53 | 1 | } |
|
54 | |||
55 | /** |
||
56 | * @param int $key |
||
57 | * @return FilterInterface |
||
58 | */ |
||
59 | 3 | public function get(int $key): FilterInterface |
|
60 | { |
||
61 | 3 | return $this->getInnerIterator()->offsetGet($key); |
|
62 | } |
||
63 | |||
64 | /** |
||
65 | * @return int |
||
66 | */ |
||
67 | 1 | public function count(): int |
|
70 | } |
||
71 | } |
||
72 |