PHP Класс Parkour\Traverse

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Описание методов

customFilter() публичный статический Метод

См. также: filter()
public static customFilter ( array $data, callable $cb, $keyed = true )
$data array
$cb callable

each() публичный статический Метод

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

every() публичный статический Метод

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.
Результат boolean If every element passes the test.

filter() публичный статический Метод

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.
Результат array Filtered data.

find() публичный статический Метод

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.
Результат mixed Value.

findKey() публичный статический Метод

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.
Результат integer | string Key.

map() публичный статический Метод

Updates each of the given values.
public static map ( array $data, callable $cb ) : array
$data array Data.
$cb callable Function to map values.
Результат array Mapped data.

mapKeys() публичный статический Метод

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.
Результат array Mapped data.

nativeFilter() публичный статический Метод

См. также: filter()
public static nativeFilter ( array $data, callable $cb, $keyed = true )
$data array
$cb callable

reduce() публичный статический Метод

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.
Результат mixed Result.

reject() публичный статический Метод

The opposite of filter().
public static reject ( array $data, callable $cb, $keyed = true ) : array
$data array Data.
$cb callable Function to filter values.
Результат array Filtered data.

some() публичный статический Метод

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.
Результат boolean If some elements passes the test.