class SortKeys extends ArrayMutator (View source)

Sorts the keys of an array.

Supports built-in PHP sorting flags. See https://www.php.net/manual/en/function.sort.php for more information.

Methods

__construct(SortDirection $direction = SortDirection::Asc, int $flags = SORT_REGULAR)

No description

mixed
__invoke(mixed $value)

Mutate the input value.

from  Mutator
static SortKeys
asc(int $flags = SORT_REGULAR)

Sorts the keys of an array in ascending order.

static SortKeys
desc(int $flags = SORT_REGULAR)

Sorts the keys of an array in descending order.

static SortKeys
make(SortDirection $direction = SortDirection::Asc, int $flags = SORT_REGULAR)

No description

mixed
mutate(mixed $value)

Mutate the input value.

array
mutateArray(array $array)

No description

Details

__construct(SortDirection $direction = SortDirection::Asc, int $flags = SORT_REGULAR)

No description

Parameters

SortDirection $direction

The direction to sort by (optional, default: SortDirection::Asc)

int $flags

Flags to pass to the PHP sort function (default: SORT_REGULAR)

final mixed __invoke(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

static SortKeys asc(int $flags = SORT_REGULAR)

Sorts the keys of an array in ascending order.

Parameters

int $flags

Flags to pass to the PHP sort function (default: SORT_REGULAR)

Return Value

SortKeys

static SortKeys desc(int $flags = SORT_REGULAR)

Sorts the keys of an array in descending order.

Parameters

int $flags

Flags to pass to the PHP sort function (default: SORT_REGULAR)

Return Value

SortKeys

static SortKeys make(SortDirection $direction = SortDirection::Asc, int $flags = SORT_REGULAR)

No description

Parameters

SortDirection $direction

The direction to sort by (optional, default: SortDirection::Asc)

int $flags

Flags to pass to the PHP sort function (default: SORT_REGULAR)

Return Value

SortKeys

mixed mutate(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

protected array mutateArray(array $array)

No description

Parameters

array $array

Return Value

array