PHP Class Parkour\Traverse

Afficher le fichier Open project: benjamminf/craft-embedded-assets Class Usage Examples

Méthodes publiques

Méthode 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 méthode

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

each() public static méthode

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

every() public static méthode

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.
Résultat boolean If every element passes the test.

filter() public static méthode

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.
Résultat array Filtered data.

find() public static méthode

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.
Résultat mixed Value.

findKey() public static méthode

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.
Résultat integer | string Key.

map() public static méthode

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

mapKeys() public static méthode

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.
Résultat array Mapped data.

nativeFilter() public static méthode

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

reduce() public static méthode

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.
Résultat mixed Result.

reject() public static méthode

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

some() public static méthode

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.
Résultat boolean If some elements passes the test.