| @@ 302-314 (lines=13) @@ | ||
| 299 | * |
|
| 300 | * @return mixed the data stored in the node. |
|
| 301 | */ |
|
| 302 | protected function deleteBeginning() { |
|
| 303 | // if only there is an element |
|
| 304 | if($this->head->next === $this->head) { |
|
| 305 | $temp = $this->head; |
|
| 306 | $this->head = null; |
|
| 307 | } else { |
|
| 308 | $temp = $this->head; |
|
| 309 | $this->head = &$this->head->next; |
|
| 310 | $this->tail->next = &$this->head; |
|
| 311 | ||
| 312 | } |
|
| 313 | return $temp->data; |
|
| 314 | } |
|
| 315 | ||
| 316 | /** |
|
| 317 | * Deletes at the specified position and returns the data stored. |
|
| @@ 295-308 (lines=14) @@ | ||
| 292 | /** |
|
| 293 | * {@inheritDoc} |
|
| 294 | */ |
|
| 295 | protected function deleteBeginning() { |
|
| 296 | // if only there is an element |
|
| 297 | if($this->head->next === $this->head) { |
|
| 298 | $temp = $this->head; |
|
| 299 | $this->head = null; |
|
| 300 | return $temp->data; |
|
| 301 | } |
|
| 302 | ||
| 303 | $temp = $this->head; |
|
| 304 | $this->head = &$this->head->next; |
|
| 305 | $this->tail->next = &$this->head; |
|
| 306 | ||
| 307 | return $temp->data; |
|
| 308 | } |
|
| 309 | ||
| 310 | /** |
|
| 311 | * {@inheritDoc} |
|