Skip to content
This repository was archived by the owner on Jul 6, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions src/Methods/ArraysMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,19 +505,15 @@ public static function reject($array, Closure $closure)
*/
public static function removeFirst($array)
{
array_shift($array);

return $array;
return array_slice($array, 1);
}

/**
* Remove the last value from an array.
*/
public static function removeLast($array)
{
array_pop($array);

return $array;
return array_slice($array, 0, -1);
}

/**
Expand Down Expand Up @@ -551,19 +547,15 @@ public static function removeValue($array, $value)
*/
public static function prepend($array, $value)
{
array_unshift($array, $value);

return $array;
return array_merge([$value], $array);
}

/**
* Append a value to an array.
*/
public static function append($array, $value)
{
array_push($array, $value);

return $array;
return array_merge($array, [$value]);
}

/*
Expand Down