| @@ 304-319 (lines=16) @@ | ||
| 301 | /** |
|
| 302 | * {@inheritDoc} |
|
| 303 | */ |
|
| 304 | protected function deleteEnd() { |
|
| 305 | $prev = $this->head; |
|
| 306 | $current = $this->head; |
|
| 307 | ||
| 308 | while($current !== $this->tail) { |
|
| 309 | $prev = $current; |
|
| 310 | $current = $current->next; |
|
| 311 | } |
|
| 312 | ||
| 313 | $temp = $current; |
|
| 314 | $prev->next = &$this->head; |
|
| 315 | $this->tail = &$prev; |
|
| 316 | $current = null; |
|
| 317 | ||
| 318 | return $temp->data; |
|
| 319 | } |
|
| 320 | ||
| 321 | public function clear() { |
|
| 322 | while($this->head !== null) { |
|
| @@ 313-329 (lines=17) @@ | ||
| 310 | * |
|
| 311 | * @return mixed the data stored in the node. |
|
| 312 | */ |
|
| 313 | protected function deleteEnd() { |
|
| 314 | $prev = $this->head; |
|
| 315 | $current = $this->head; |
|
| 316 | ||
| 317 | while($current !== $this->tail) { |
|
| 318 | $prev = $current; |
|
| 319 | $current = $current->next; |
|
| 320 | } |
|
| 321 | ||
| 322 | $temp = $current; |
|
| 323 | $prev->next = &$this->head; |
|
| 324 | $this->head->prev = &$prev; |
|
| 325 | $this->tail = &$prev; |
|
| 326 | $current = null; |
|
| 327 | ||
| 328 | return $temp->data; |
|
| 329 | } |
|
| 330 | ||
| 331 | /** |
|
| 332 | * Reset the cursor position. |
|