Helper class for partitioning an array with an equivalence relation.

package Default

 Methods

Creates a partition.

__construct(array $elements) 

Parameters

$elements

array

Creates a partition from a set of objects.

fromObjects(array $array, callable $key) : \FeaturePhp\Helper\Partition
Static

Parameters

$array

array

$key

callable

Returns

\FeaturePhp\Helper\Partition

Partitions the elements using an equivalence relation.

partitionBy(callable $key) : array<mixed,array>

Parameters

$key

callable

a binary relation on the elements

Returns

array<mixed,array>

 Properties

 

the set that should be partitioned

$elements : array

Default