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