Total Complexity | 6 |
Total Lines | 64 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php namespace Mbh\Collection\Traits\Sequenceable\LinkedList; |
||
14 | trait Iterator |
||
15 | { |
||
16 | protected $head; |
||
17 | protected $current; |
||
18 | protected $offset = -1; |
||
19 | |||
20 | /** |
||
21 | * @link http://php.net/manual/en/iterator.current.php |
||
22 | * @return mixed |
||
23 | */ |
||
24 | public function current() |
||
25 | { |
||
26 | return $this->current->value(); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @link http://php.net/manual/en/iterator.next.php |
||
31 | * @return void |
||
32 | */ |
||
33 | public function next() |
||
34 | { |
||
35 | $this->forward(); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @return void |
||
40 | */ |
||
41 | public function prev() |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @link http://php.net/manual/en/iterator.key.php |
||
48 | * @return mixed |
||
49 | */ |
||
50 | public function key() |
||
51 | { |
||
52 | return $this->offset; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @link http://php.net/manual/en/iterator.valid.php |
||
57 | * @return boolean |
||
58 | */ |
||
59 | public function valid() |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @link http://php.net/manual/en/iterator.rewind.php |
||
66 | * @return void |
||
67 | */ |
||
68 | public function rewind() |
||
73 | } |
||
74 | |||
75 | abstract protected function backward(); |
||
76 | |||
77 | abstract protected function forward(); |
||
78 | } |
||
79 |