@@ 315-330 (lines=16) @@ | ||
312 | /** |
|
313 | * {@inheritDoc} |
|
314 | */ |
|
315 | protected function deleteEnd() { |
|
316 | $prev = $this->head; |
|
317 | $current = $this->head; |
|
318 | ||
319 | while($current !== $this->tail) { |
|
320 | $prev = $current; |
|
321 | $current = $current->next; |
|
322 | } |
|
323 | ||
324 | $temp = $current; |
|
325 | $prev->next = &$this->head; |
|
326 | $this->tail = &$prev; |
|
327 | $current = null; |
|
328 | ||
329 | return $temp->data; |
|
330 | } |
|
331 | ||
332 | public function clear() { |
|
333 | while($this->head !== null) { |
@@ 325-341 (lines=17) @@ | ||
322 | * |
|
323 | * @return mixed the data stored in the node. |
|
324 | */ |
|
325 | protected function deleteEnd() { |
|
326 | $prev = $this->head; |
|
327 | $current = $this->head; |
|
328 | ||
329 | while($current !== $this->tail) { |
|
330 | $prev = $current; |
|
331 | $current = $current->next; |
|
332 | } |
|
333 | ||
334 | $temp = $current; |
|
335 | $prev->next = &$this->head; |
|
336 | $this->head->prev = &$prev; |
|
337 | $this->tail = &$prev; |
|
338 | $current = null; |
|
339 | ||
340 | return $temp->data; |
|
341 | } |
|
342 | ||
343 | /** |
|
344 | * Reset the cursor position. |