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