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<int|string,mixed> $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<int|string,mixed> $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<int|string,mixed> $set, string $filterProperty, bool $negate)

Internal method for filtering

array
groupBy(array|Collection<int|string,mixed> $set, string $groupingKey)

The input is assumed to be an array or Collection of objects.

bool
allowsCallOfMethod(string $methodName)

All methods are considered safe

Details

array filter(array|Collection<int|string,mixed> $set, string $filterProperty)

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

Parameters

array|Collection<int|string,mixed> $set
string $filterProperty

Return Value

array

array filterNegated(array|Collection<int|string,mixed> $set, string $filterProperty)

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

Parameters

array|Collection<int|string,mixed> $set
string $filterProperty

Return Value

array

protected array filterInternal(array|Collection<int|string,mixed> $set, string $filterProperty, bool $negate)

Internal method for filtering

Parameters

array|Collection<int|string,mixed> $set
string $filterProperty
bool $negate

Return Value

array

array groupBy(array|Collection<int|string,mixed> $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<int|string,mixed> $set
string $groupingKey

Return Value

array

bool allowsCallOfMethod(string $methodName)

All methods are considered safe

Parameters

string $methodName

Return Value

bool