@@ 274-290 (lines=17) @@ | ||
271 | * |
|
272 | * @return null if the head is null (or list is empty) |
|
273 | */ |
|
274 | public function getAll() { |
|
275 | if($this->head === null) { |
|
276 | return; |
|
277 | } |
|
278 | ||
279 | if($this->head->next === $this->tail) { |
|
280 | yield $this->head->data; |
|
281 | } else { |
|
282 | $current = $this->head; |
|
283 | $i = 0; |
|
284 | while($i < $this->size) { |
|
285 | yield $current->data; |
|
286 | $current = $current->next; |
|
287 | $i++; |
|
288 | } |
|
289 | } |
|
290 | } |
|
291 | ||
292 | /** |
|
293 | * Deletes at the beginnig of the list and returns the data stored. |
@@ 225-241 (lines=17) @@ | ||
222 | * |
|
223 | * @return null if the head is null (or list is empty) |
|
224 | */ |
|
225 | public function getAll() { |
|
226 | if($this->head === null) { |
|
227 | return; |
|
228 | } |
|
229 | ||
230 | if($this->head === $this->tail) { |
|
231 | yield $this->head->data; |
|
232 | } else { |
|
233 | $current = $this->head; |
|
234 | $i = 0; |
|
235 | while($i < $this->size) { |
|
236 | yield $current->data; |
|
237 | $current = $current->next; |
|
238 | $i++; |
|
239 | } |
|
240 | } |
|
241 | } |
|
242 | ||
243 | /** |
|
244 | * {@inheritDoc} |