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