@@ 346-362 (lines=17) @@ | ||
343 | * |
|
344 | * @return mixed the data stored in the node. |
|
345 | */ |
|
346 | protected function deleteEnd() { |
|
347 | $prev = $this->head; |
|
348 | $current = $this->head; |
|
349 | ||
350 | while($current !== $this->tail) { |
|
351 | $prev = $current; |
|
352 | $current = $current->next; |
|
353 | } |
|
354 | ||
355 | $temp = $current; |
|
356 | $prev->next = &$this->head; |
|
357 | $this->head->prev = &$prev; |
|
358 | $this->tail = &$prev; |
|
359 | $current = null; |
|
360 | ||
361 | return $temp->data; |
|
362 | } |
|
363 | ||
364 | /** |
|
365 | * 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) { |