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