@@ 269-282 (lines=14) @@ | ||
266 | /** |
|
267 | * {@inheritDoc} |
|
268 | */ |
|
269 | protected function deleteBeginning() { |
|
270 | // if only there is an element |
|
271 | if($this->head->next === $this->head) { |
|
272 | $temp = $this->head; |
|
273 | $this->head = null; |
|
274 | return $temp->data; |
|
275 | } |
|
276 | ||
277 | $temp = $this->head; |
|
278 | $this->head = &$this->head->next; |
|
279 | $this->tail->next = &$this->head; |
|
280 | ||
281 | return $temp->data; |
|
282 | } |
|
283 | ||
284 | /** |
|
285 | * {@inheritDoc} |
@@ 270-282 (lines=13) @@ | ||
267 | * |
|
268 | * @return mixed the data stored in the node. |
|
269 | */ |
|
270 | protected function deleteBeginning() { |
|
271 | // if only there is an element |
|
272 | if($this->head->next === $this->head) { |
|
273 | $temp = $this->head; |
|
274 | $this->head = null; |
|
275 | } else { |
|
276 | $temp = $this->head; |
|
277 | $this->head = &$this->head->next; |
|
278 | $this->tail->next = &$this->head; |
|
279 | ||
280 | } |
|
281 | return $temp->data; |
|
282 | } |
|
283 | ||
284 | /** |
|
285 | * Deletes at the specified position and returns the data stored. |