\EasyWeChat\SupportArr

Array helper from Illuminate\Support\Arr.

Summary

Methods
Properties
Constants
add()
build()
divide()
dot()
except()
fetch()
first()
last()
flatten()
forget()
get()
only()
pluck()
pull()
set()
sort()
where()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

add()

add(array  $array, string  $key, mixed  $value) : array

Add an element to an array using "dot" notation if it doesn't exist.

Parameters

array $array
string $key
mixed $value

Returns

array

build()

build(array  $array, \Closure  $callback) : array

Build a new array using a callback.

Parameters

array $array
\Closure $callback

Returns

array

divide()

divide(array  $array) : array

Divide an array into two arrays. One with keys and the other with values.

Parameters

array $array

Returns

array

dot()

dot(array  $array, string  $prepend = '') : array

Flatten a multi-dimensional associative array with dots.

Parameters

array $array
string $prepend

Returns

array

except()

except(array  $array, array|string  $keys) : array

Get all of the given array except for a specified array of items.

Parameters

array $array
array|string $keys

Returns

array

fetch()

fetch(array  $array, string  $key) : array

Fetch a flattened array of a nested array element.

Parameters

array $array
string $key

Returns

array

first()

first(array  $array, \Closure  $callback, mixed  $default = null) : mixed

Return the first element in an array passing a given truth test.

Parameters

array $array
\Closure $callback
mixed $default

Returns

mixed

last()

last(array  $array, \Closure  $callback, mixed  $default = null) : mixed

Return the last element in an array passing a given truth test.

Parameters

array $array
\Closure $callback
mixed $default

Returns

mixed

flatten()

flatten(array  $array) : array

Flatten a multi-dimensional array into a single level.

Parameters

array $array

Returns

array

forget()

forget(array  $array, array|string  $keys) 

Remove one or many array items from a given array using "dot" notation.

Parameters

array $array
array|string $keys

get()

get(array  $array, string  $key, mixed  $default = null) : mixed

Get an item from an array using "dot" notation.

Parameters

array $array
string $key
mixed $default

Returns

mixed

only()

only(array  $array, array|string  $keys) : array

Get a subset of the items from the given array.

Parameters

array $array
array|string $keys

Returns

array

pluck()

pluck(array  $array, string  $value, string  $key = null) : array

Pluck an array of values from an array.

Parameters

array $array
string $value
string $key

Returns

array

pull()

pull(array  $array, string  $key, mixed  $default = null) : mixed

Get a value from the array, and remove it.

Parameters

array $array
string $key
mixed $default

Returns

mixed

set()

set(array  $array, string  $key, mixed  $value) : array

Set an array item to a given value using "dot" notation.

If no key is given to the method, the entire array will be replaced.

Parameters

array $array
string $key
mixed $value

Returns

array

sort()

sort(array  $array, \Closure  $callback) : array

Sort the array using the given Closure.

Parameters

array $array
\Closure $callback

Returns

array

where()

where(array  $array, \Closure  $callback) : array

Filter the array using the given Closure.

Parameters

array $array
\Closure $callback

Returns

array