Documentation

MultiSort
in package
implements SortCombinator

FinalYes

Enable sorting a record based on multiple column.

The class can be used with PHP's usort and uasort functions.

Tags
phpstan-import-type

Ordering from SortCombinator

phpstan-import-type

OrderingExtended from SortCombinator

Table of Contents

Interfaces

SortCombinator
Enable sorting a record based on its value.

Properties

$sorts  : array<string|int, Ordering>

Methods

__invoke()  : int
The class comparison method.
all()  : self
append()  : self
Return an instance with the specified sorting algorithm added after the currently registered sorting algorithms.
prepend()  : self
Return an instance with the specified sorting algorithm added before the currently registered sorting algorithms.
sort()  : Iterator
Sort an iterable structure with the class comparison method and maintain index association.
__construct()  : mixed

Properties

$sorts read-only

private array<string|int, Ordering> $sorts

Methods

__invoke()

The class comparison method.

public __invoke(mixed $valueA, mixed $valueB) : int

The method must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

Parameters
$valueA : mixed
$valueB : mixed
Return values
int

all()

public static all(OrderingExtended ...$sorts) : self
Parameters
$sorts : OrderingExtended
Return values
self

append()

Return an instance with the specified sorting algorithm added after the currently registered sorting algorithms.

public append(OrderingExtended ...$sorts) : self
Parameters
$sorts : OrderingExtended
Return values
self

prepend()

Return an instance with the specified sorting algorithm added before the currently registered sorting algorithms.

public prepend(OrderingExtended ...$sorts) : self
Parameters
$sorts : OrderingExtended
Return values
self

sort()

Sort an iterable structure with the class comparison method and maintain index association.

public sort(iterable<string|int, mixed> $value) : Iterator
Parameters
$value : iterable<string|int, mixed>
Return values
Iterator

__construct()

private __construct(OrderingExtended ...$sorts) : mixed
Parameters
$sorts : OrderingExtended

        
On this page

Search results