PHP Class Parkour\Traverse

Datei anzeigen Open project: benjamminf/craft-embedded-assets Class Usage Examples

Public Methods

Method Description
customFilter ( array $data, callable $cb, $keyed = true )
each ( array $data, callable $cb ) Iterates over the given data.
every ( array $data, callable $cb ) : boolean Returns true if every element of the given data passes a thruth test.
filter ( array $data, callable $cb, $keyed = true ) : array Filters each of the given values through a function.
find ( array $data, callable $cb, mixed $default = null ) : mixed Finds a value in the given data.
findKey ( array $data, callable $cb, mixed $default = null ) : integer | string Finds a value in the given data and returns its key.
map ( array $data, callable $cb ) : array Updates each of the given values.
mapKeys ( array $data, callable $cb ) : array Updates the keys each of the given data.
nativeFilter ( array $data, callable $cb, $keyed = true )
reduce ( array $data, callable $cb, mixed $memo ) : mixed Boils down a list of values to a single value.
reject ( array $data, callable $cb, $keyed = true ) : array The opposite of filter().
some ( array $data, callable $cb ) : boolean Returns true if some elements of the given data passes a thruth test.

Method Details

customFilter() public static method

See also: filter()
public static customFilter ( array $data, callable $cb, $keyed = true )
$data array
$cb callable

each() public static method

Iterates over the given data.
public static each ( array $data, callable $cb )
$data array Data.
$cb callable Function that receives values.

every() public static method

Returns true if every element of the given data passes a thruth test.
public static every ( array $data, callable $cb ) : boolean
$data array Data.
$cb callable Test.
return boolean If every element passes the test.

filter() public static method

Filters each of the given values through a function.
public static filter ( array $data, callable $cb, $keyed = true ) : array
$data array Data.
$cb callable Function to filter values.
return array Filtered data.

find() public static method

Finds a value in the given data.
public static find ( array $data, callable $cb, mixed $default = null ) : mixed
$data array Data.
$cb callable Function to find value.
$default mixed Default value.
return mixed Value.

findKey() public static method

Finds a value in the given data and returns its key.
public static findKey ( array $data, callable $cb, mixed $default = null ) : integer | string
$data array Data.
$cb callable Function to find value.
$default mixed Default value.
return integer | string Key.

map() public static method

Updates each of the given values.
public static map ( array $data, callable $cb ) : array
$data array Data.
$cb callable Function to map values.
return array Mapped data.

mapKeys() public static method

Updates the keys each of the given data.
public static mapKeys ( array $data, callable $cb ) : array
$data array Data.
$cb callable Function to map keys.
return array Mapped data.

nativeFilter() public static method

See also: filter()
public static nativeFilter ( array $data, callable $cb, $keyed = true )
$data array
$cb callable

reduce() public static method

Boils down a list of values to a single value.
public static reduce ( array $data, callable $cb, mixed $memo ) : mixed
$data array Data.
$cb callable Function to reduce values.
$memo mixed Initial value.
return mixed Result.

reject() public static method

The opposite of filter().
public static reject ( array $data, callable $cb, $keyed = true ) : array
$data array Data.
$cb callable Function to filter values.
return array Filtered data.

some() public static method

Returns true if some elements of the given data passes a thruth test.
public static some ( array $data, callable $cb ) : boolean
$data array Data.
$cb callable Test.
return boolean If some elements passes the test.