| @@ 342-358 (lines=17) @@ | ||
| 339 | * |
|
| 340 | * @return mixed the data stored in the node. |
|
| 341 | */ |
|
| 342 | protected function deleteEnd() { |
|
| 343 | $prev = $this->head; |
|
| 344 | $current = $this->head; |
|
| 345 | ||
| 346 | while($current !== $this->tail) { |
|
| 347 | $prev = $current; |
|
| 348 | $current = $current->next; |
|
| 349 | } |
|
| 350 | ||
| 351 | $temp = $current; |
|
| 352 | $prev->next = &$this->head; |
|
| 353 | $this->head->prev = &$prev; |
|
| 354 | $this->tail = &$prev; |
|
| 355 | $current = null; |
|
| 356 | ||
| 357 | return $temp->data; |
|
| 358 | } |
|
| 359 | ||
| 360 | /** |
|
| 361 | * Reset the cursor position. |
|
| @@ 332-347 (lines=16) @@ | ||
| 329 | /** |
|
| 330 | * {@inheritDoc} |
|
| 331 | */ |
|
| 332 | protected function deleteEnd() { |
|
| 333 | $prev = $this->head; |
|
| 334 | $current = $this->head; |
|
| 335 | ||
| 336 | while($current !== $this->tail) { |
|
| 337 | $prev = $current; |
|
| 338 | $current = $current->next; |
|
| 339 | } |
|
| 340 | ||
| 341 | $temp = $current; |
|
| 342 | $prev->next = &$this->head; |
|
| 343 | $this->tail = &$prev; |
|
| 344 | $current = null; |
|
| 345 | ||
| 346 | return $temp->data; |
|
| 347 | } |
|
| 348 | ||
| 349 | public function clear() { |
|
| 350 | while($this->head !== null) { |
|