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