| @@ 257-273 (lines=17) @@ | ||
| 254 | * |
|
| 255 | * @return null if the head is null (or list is empty) |
|
| 256 | */ |
|
| 257 | public function getAll() { |
|
| 258 | if($this->head === null) { |
|
| 259 | return; |
|
| 260 | } |
|
| 261 | ||
| 262 | if($this->head->next === $this->tail) { |
|
| 263 | yield $this->head->data; |
|
| 264 | } else { |
|
| 265 | $current = $this->head; |
|
| 266 | $i = 0; |
|
| 267 | while($i < $this->size) { |
|
| 268 | yield $current->data; |
|
| 269 | $current = $current->next; |
|
| 270 | $i++; |
|
| 271 | } |
|
| 272 | } |
|
| 273 | } |
|
| 274 | ||
| 275 | /** |
|
| 276 | * {@inheritDoc} |
|
| @@ 208-224 (lines=17) @@ | ||
| 205 | * |
|
| 206 | * @return null if the head is null (or list is empty) |
|
| 207 | */ |
|
| 208 | public function getAll() { |
|
| 209 | if($this->head === null) { |
|
| 210 | return; |
|
| 211 | } |
|
| 212 | ||
| 213 | if($this->head === $this->tail) { |
|
| 214 | yield $this->head->data; |
|
| 215 | } else { |
|
| 216 | $current = $this->head; |
|
| 217 | $i = 0; |
|
| 218 | while($i < $this->size) { |
|
| 219 | yield $current->data; |
|
| 220 | $current = $current->next; |
|
| 221 | $i++; |
|
| 222 | } |
|
| 223 | } |
|
| 224 | } |
|
| 225 | ||
| 226 | /** |
|
| 227 | * {@inheritDoc} |
|