| @@ 30-38 (lines=9) @@ | ||
| 27 | * @return $this The current array with pushed elements |
|
| 28 | * to the end of array |
|
| 29 | */ |
|
| 30 | public function push(/* variadic arguments allowed */) |
|
| 31 | { |
|
| 32 | if (func_num_args()) { |
|
| 33 | $args = array_merge([&$this->elements], func_get_args()); |
|
| 34 | call_user_func_array('array_push', $args); |
|
| 35 | } |
|
| 36 | ||
| 37 | return $this; |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * Shifts a specified value off the beginning of array. |
|
| @@ 55-63 (lines=9) @@ | ||
| 52 | * |
|
| 53 | * @return $this The current array with prepended elements to the beginning of array |
|
| 54 | */ |
|
| 55 | public function unshift(/* variadic arguments allowed */) |
|
| 56 | { |
|
| 57 | if (func_num_args()) { |
|
| 58 | $args = array_merge([&$this->elements], func_get_args()); |
|
| 59 | call_user_func_array('array_unshift', $args); |
|
| 60 | } |
|
| 61 | ||
| 62 | return $this; |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||