@@ 148-160 (lines=13) @@ | ||
145 | /** |
|
146 | * @inheritDoc |
|
147 | */ |
|
148 | public function pop() |
|
149 | { |
|
150 | if ($this->isEmpty()) { |
|
151 | throw new UnderflowException(); |
|
152 | } |
|
153 | ||
154 | $value = $this->last(); |
|
155 | unset($this[$this->count() - 1]); |
|
156 | ||
157 | $this->checkCapacity(); |
|
158 | ||
159 | return $value; |
|
160 | } |
|
161 | ||
162 | /** |
|
163 | * Pushes all values of either an array or traversable object. |
|
@@ 219-231 (lines=13) @@ | ||
216 | /** |
|
217 | * @inheritDoc |
|
218 | */ |
|
219 | public function shift() |
|
220 | { |
|
221 | if ($this->isEmpty()) { |
|
222 | throw new UnderflowException(); |
|
223 | } |
|
224 | ||
225 | $value = $this->first(); |
|
226 | unset($this[0]); |
|
227 | ||
228 | $this->checkCapacity(); |
|
229 | ||
230 | return $value; |
|
231 | } |
|
232 | ||
233 | public function toArray(): array |
|
234 | { |