class ArrayHelper implements ProtectedContextAwareInterface (View source)

Some Functional Programming Array helpers for Eel contexts

These helpers are WORK IN PROGRESS and NOT STABLE YET

Methods

array
filter(array|Collection $set, string $filterProperty)

Filter an array of objects, by only keeping the elements where each object's $filterProperty evaluates to true.

array
filterNegated(array|Collection $set, string $filterProperty)

Filter an array of objects, by only keeping the elements where each object's $filterProperty evaluates to false.

array
filterInternal(array|Collection $set, string $filterProperty, bool $negate)

Internal method for filtering

array
groupBy(array|Collection $set, string $groupingKey)

The input is assumed to be an array or Collection of objects. Groups this input by the $groupingKey property of each element.

bool
allowsCallOfMethod(string $methodName)

All methods are considered safe

Details

array filter(array|Collection $set, string $filterProperty)

Filter an array of objects, by only keeping the elements where each object's $filterProperty evaluates to true.

Parameters

array|Collection $set
string $filterProperty

Return Value

array

array filterNegated(array|Collection $set, string $filterProperty)

Filter an array of objects, by only keeping the elements where each object's $filterProperty evaluates to false.

Parameters

array|Collection $set
string $filterProperty

Return Value

array

protected array filterInternal(array|Collection $set, string $filterProperty, bool $negate)

Internal method for filtering

Parameters

array|Collection $set
string $filterProperty
bool $negate

Return Value

array

array groupBy(array|Collection $set, string $groupingKey)

The input is assumed to be an array or Collection of objects. Groups this input by the $groupingKey property of each element.

Parameters

array|Collection $set
string $groupingKey

Return Value

array

bool allowsCallOfMethod(string $methodName)

All methods are considered safe

Parameters

string $methodName

Return Value

bool