| Total Complexity | 5 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | trait IteratorTrait{ |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var array |
||
| 25 | */ |
||
| 26 | protected $array = []; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var int |
||
| 30 | */ |
||
| 31 | protected $offset = 0; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @link http://php.net/manual/iterator.current.php |
||
| 35 | * @inheritdoc |
||
| 36 | */ |
||
| 37 | public function current(){ |
||
| 38 | return $this->array[$this->offset] ?? null; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @link http://php.net/manual/iterator.next.php |
||
| 43 | * @inheritdoc |
||
| 44 | */ |
||
| 45 | public function next(){ |
||
| 46 | $this->offset++; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @link http://php.net/manual/iterator.key.php |
||
| 51 | * @inheritdoc |
||
| 52 | */ |
||
| 53 | public function key(){ |
||
| 54 | return $this->offset; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @link http://php.net/manual/iterator.valid.php |
||
| 59 | * @inheritdoc |
||
| 60 | */ |
||
| 61 | public function valid():bool{ |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @link http://php.net/manual/iterator.rewind.php |
||
| 67 | * @inheritdoc |
||
| 68 | */ |
||
| 69 | public function rewind(){ |
||
| 74 |