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