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