| @@ 278-291 (lines=14) @@ | ||
| 275 | /** |
|
| 276 | * {@inheritDoc} |
|
| 277 | */ |
|
| 278 | protected function deleteBeginning() { |
|
| 279 | // if only there is an element |
|
| 280 | if($this->head->next === $this->head) { |
|
| 281 | $temp = $this->head; |
|
| 282 | $this->head = null; |
|
| 283 | return $temp->data; |
|
| 284 | } |
|
| 285 | ||
| 286 | $temp = $this->head; |
|
| 287 | $this->head = &$this->head->next; |
|
| 288 | $this->tail->next = &$this->head; |
|
| 289 | ||
| 290 | return $temp->data; |
|
| 291 | } |
|
| 292 | ||
| 293 | /** |
|
| 294 | * {@inheritDoc} |
|
| @@ 281-293 (lines=13) @@ | ||
| 278 | * |
|
| 279 | * @return mixed the data stored in the node. |
|
| 280 | */ |
|
| 281 | protected function deleteBeginning() { |
|
| 282 | // if only there is an element |
|
| 283 | if($this->head->next === $this->head) { |
|
| 284 | $temp = $this->head; |
|
| 285 | $this->head = null; |
|
| 286 | } else { |
|
| 287 | $temp = $this->head; |
|
| 288 | $this->head = &$this->head->next; |
|
| 289 | $this->tail->next = &$this->head; |
|
| 290 | ||
| 291 | } |
|
| 292 | return $temp->data; |
|
| 293 | } |
|
| 294 | ||
| 295 | /** |
|
| 296 | * Deletes at the specified position and returns the data stored. |
|