| @@ 248-264 (lines=17) @@ | ||
| 245 | * |
|
| 246 | * @return null if the head is null (or list is empty) |
|
| 247 | */ |
|
| 248 | public function getAll() { |
|
| 249 | if($this->head === null) { |
|
| 250 | return; |
|
| 251 | } |
|
| 252 | ||
| 253 | if($this->head->next === $this->tail) { |
|
| 254 | yield $this->head->data; |
|
| 255 | } else { |
|
| 256 | $current = $this->head; |
|
| 257 | $i = 0; |
|
| 258 | while($i < $this->size) { |
|
| 259 | yield $current->data; |
|
| 260 | $current = $current->next; |
|
| 261 | $i++; |
|
| 262 | } |
|
| 263 | } |
|
| 264 | } |
|
| 265 | ||
| 266 | /** |
|
| 267 | * {@inheritDoc} |
|
| @@ 197-213 (lines=17) @@ | ||
| 194 | * |
|
| 195 | * @return null if the head is null (or list is empty) |
|
| 196 | */ |
|
| 197 | public function getAll() { |
|
| 198 | if($this->head === null) { |
|
| 199 | return; |
|
| 200 | } |
|
| 201 | ||
| 202 | if($this->head === $this->tail) { |
|
| 203 | yield $this->head->data; |
|
| 204 | } else { |
|
| 205 | $current = $this->head; |
|
| 206 | $i = 0; |
|
| 207 | while($i < $this->size) { |
|
| 208 | yield $current->data; |
|
| 209 | $current = $current->next; |
|
| 210 | $i++; |
|
| 211 | } |
|
| 212 | } |
|
| 213 | } |
|
| 214 | ||
| 215 | /** |
|
| 216 | * {@inheritDoc} |
|