Total Complexity | 9 |
Total Lines | 72 |
Duplicated Lines | 0 % |
Coverage | 80.95% |
Changes | 0 |
1 | <?php |
||
10 | class PathCollection implements \Iterator, \Countable |
||
11 | { |
||
12 | /** |
||
13 | * @var \Xervice\Twig\Business\Dependency\Path\PathProviderInterface[] |
||
14 | */ |
||
15 | private $collection; |
||
16 | |||
17 | /** |
||
18 | * @var int |
||
19 | */ |
||
20 | private $position; |
||
21 | |||
22 | /** |
||
23 | * Collection constructor. |
||
24 | * |
||
25 | * @param \Xervice\Twig\Business\Dependency\Path\PathProviderInterface[] $collection |
||
26 | */ |
||
27 | 2 | public function __construct(array $collection) |
|
28 | { |
||
29 | 2 | foreach ($collection as $validator) { |
|
30 | 2 | $this->add($validator); |
|
31 | } |
||
32 | 2 | } |
|
33 | |||
34 | /** |
||
35 | * @param \Xervice\Twig\Business\Dependency\Path\PathProviderInterface $validator |
||
36 | */ |
||
37 | 2 | public function add(PathProviderInterface $validator): void |
|
38 | { |
||
39 | 2 | $this->collection[] = $validator; |
|
40 | 2 | } |
|
41 | |||
42 | /** |
||
43 | * @return \Xervice\Twig\Business\Dependency\Path\PathProviderInterface |
||
44 | */ |
||
45 | 2 | public function current(): PathProviderInterface |
|
48 | } |
||
49 | |||
50 | 2 | public function next(): void |
|
51 | { |
||
52 | 2 | $this->position++; |
|
53 | 2 | } |
|
54 | |||
55 | /** |
||
56 | * @return int |
||
57 | */ |
||
58 | public function key(): int |
||
59 | { |
||
60 | return $this->position; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @return bool |
||
65 | */ |
||
66 | 2 | public function valid(): bool |
|
69 | } |
||
70 | |||
71 | 2 | public function rewind(): void |
|
74 | 2 | } |
|
75 | |||
76 | /** |
||
77 | * @return int |
||
78 | */ |
||
79 | public function count(): int |
||
82 | } |
||
83 | } |