| Total Complexity | 6 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace Mbh\Collection\Traits\Sequenceable\Arrayed; |
||
| 13 | trait Iterator |
||
| 14 | { |
||
| 15 | protected $sfa = null; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Create an fixed array |
||
| 19 | * |
||
| 20 | * @param Traversable $array data |
||
| 21 | */ |
||
| 22 | protected function __construct(Traversable $array) |
||
| 23 | { |
||
| 24 | $this->sfa = $array; |
||
| 25 | $this->checkCapacity(); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Iterator |
||
| 30 | */ |
||
| 31 | public function current() |
||
| 32 | { |
||
| 33 | return $this->sfa->current(); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function key(): int |
||
| 37 | { |
||
| 38 | return $this->sfa->key(); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function next() |
||
| 42 | { |
||
| 43 | return $this->sfa->next(); |
||
| 44 | } |
||
| 45 | |||
| 46 | public function rewind() |
||
| 49 | } |
||
| 50 | |||
| 51 | public function valid() |
||
| 52 | { |
||
| 54 | } |
||
| 55 | |||
| 56 | abstract protected function checkCapacity(); |
||
| 57 | } |
||
| 58 |