| @@ 339-354 (lines=16) @@ | ||
| 336 | * |
|
| 337 | * @return mixed the data stored in the node. |
|
| 338 | */ |
|
| 339 | protected function deleteEnd() { |
|
| 340 | $prev = $this->head; |
|
| 341 | $current = $this->head; |
|
| 342 | ||
| 343 | while($current !== $this->tail) { |
|
| 344 | $prev = $current; |
|
| 345 | $current = $current->next; |
|
| 346 | } |
|
| 347 | ||
| 348 | $temp = $current; |
|
| 349 | $prev->next = &$this->head; |
|
| 350 | $this->tail = &$prev; |
|
| 351 | $current = null; |
|
| 352 | ||
| 353 | return $temp->data; |
|
| 354 | } |
|
| 355 | ||
| 356 | /** |
|
| 357 | * Converts/exports the list content into array type. |
|
| @@ 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 | * Converts/exports the list content into array type. |
|