| @@ 88-99 (lines=12) @@ | ||
| 85 | /** |
|
| 86 | * |
|
| 87 | */ |
|
| 88 | public function searchLast() { |
|
| 89 | if($this->head === null) { |
|
| 90 | return null; |
|
| 91 | } |
|
| 92 | ||
| 93 | $current = $this->head; |
|
| 94 | while($current->next !== null) { |
|
| 95 | $current = $current->next; |
|
| 96 | } |
|
| 97 | ||
| 98 | return $current; |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * Generator for retrieve all nodes stored. |
|
| @@ 106-116 (lines=11) @@ | ||
| 103 | * |
|
| 104 | * @return null if the head is null (or list is empty) |
|
| 105 | */ |
|
| 106 | public function getAll() { |
|
| 107 | if($this->head === null) { |
|
| 108 | return; |
|
| 109 | } |
|
| 110 | ||
| 111 | $current = $this->head; |
|
| 112 | while($current !== null) { |
|
| 113 | yield $current->data; |
|
| 114 | $current = $current->next; |
|
| 115 | } |
|
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| 119 | * {@inheritDoc} |
|