Skip to content

Commit

Permalink
moved the array_wrap helper function inside the Arr helper class (#18216
Browse files Browse the repository at this point in the history
)
  • Loading branch information
edenreich authored and taylorotwell committed Mar 5, 2017
1 parent fd96e30 commit eebb805
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/Illuminate/Support/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,4 +516,15 @@ public static function where($array, callable $callback)
{
return array_filter($array, $callback, ARRAY_FILTER_USE_BOTH);
}

/**
* If the given value is not an array, wrap it in one.
*
* @param mixed $value
* @return array
*/
public static function wrap($value)
{
return ! is_array($value) ? [$value] : $value;
}
}
2 changes: 1 addition & 1 deletion src/Illuminate/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ function array_where($array, callable $callback)
*/
function array_wrap($value)
{
return ! is_array($value) ? [$value] : $value;
return Arr::wrap($value);
}
}

Expand Down

0 comments on commit eebb805

Please sign in to comment.