@@ 67-78 (lines=12) @@ | ||
64 | /** |
|
65 | * |
|
66 | */ |
|
67 | public function searchLast() { |
|
68 | if($this->head === null) { |
|
69 | return null; |
|
70 | } |
|
71 | ||
72 | $current = $this->head; |
|
73 | while($current->next !== null) { |
|
74 | $current = $current->next; |
|
75 | } |
|
76 | ||
77 | return $current; |
|
78 | } |
|
79 | ||
80 | /** |
|
81 | * Generator for retrieve all nodes stored. |
|
@@ 85-95 (lines=11) @@ | ||
82 | * |
|
83 | * @return null if the head is null (or list is empty) |
|
84 | */ |
|
85 | public function getAll() { |
|
86 | if($this->head === null) { |
|
87 | return; |
|
88 | } |
|
89 | ||
90 | $current = $this->head; |
|
91 | while($current !== null) { |
|
92 | yield $current->data; |
|
93 | $current = $current->next; |
|
94 | } |
|
95 | } |
|
96 | ||
97 | /** |
|
98 | * {@inheritDoc} |