Documentation

Sort extends LookupRefValidations
in package

Table of Contents

Constants

ORDER_ASCENDING  = 1
ORDER_DESCENDING  = -1

Methods

sort()  : mixed
SORT The SORT function returns a sorted array of the elements in an array.
sortBy()  : mixed
SORTBY The SORTBY function sorts the contents of a range or array based on the values in a corresponding range or array.
validateInt()  : int
validatePositiveInt()  : int
buildVectorForSort()  : array<string|int, mixed>
enumerateArrayKeys()  : array<string|int, mixed>
executeVectorSortQuery()  : array<string|int, mixed>
prepareSortVectorValues()  : array<string|int, mixed>
processSortBy()  : array<string|int, mixed>
sortByColumn()  : array<string|int, mixed>
sortByRow()  : array<string|int, mixed>
sortLookupArrayFromVector()  : array<string|int, mixed>
validateArrayArgumentsForSort()  : void
validateScalarArgumentsForSort()  : void
validateSortOrder()  : int
validateSortVector()  : array<string|int, mixed>

Constants

ORDER_ASCENDING

public mixed ORDER_ASCENDING = 1

ORDER_DESCENDING

public mixed ORDER_DESCENDING = -1

Methods

sort()

SORT The SORT function returns a sorted array of the elements in an array.

public static sort(mixed $sortArray[, mixed $sortIndex = 1 ][, mixed $sortOrder = self::ORDER_ASCENDING ][, mixed $byColumn = false ]) : mixed

The returned array is the same shape as the provided array argument. Both $sortIndex and $sortOrder can be arrays, to provide multi-level sorting.

Parameters
$sortArray : mixed

The range of cells being sorted

$sortIndex : mixed = 1

The column or row number within the sortArray to sort on

$sortOrder : mixed = self::ORDER_ASCENDING

Flag indicating whether to sort ascending or descending Ascending = 1 (self::ORDER_ASCENDING) Descending = -1 (self::ORDER_DESCENDING)

$byColumn : mixed = false

Whether the sort should be determined by row (the default) or by column

Return values
mixed

The sorted values from the sort range

sortBy()

SORTBY The SORTBY function sorts the contents of a range or array based on the values in a corresponding range or array.

public static sortBy(mixed $sortArray, mixed ...$args) : mixed

The returned array is the same shape as the provided array argument. Both $sortIndex and $sortOrder can be arrays, to provide multi-level sorting.

Parameters
$sortArray : mixed

The range of cells being sorted

$args : mixed

At least one additional argument must be provided, The vector or range to sort on After that, arguments are passed as pairs: sort order: ascending or descending Ascending = 1 (self::ORDER_ASCENDING) Descending = -1 (self::ORDER_DESCENDING) additional arrays or ranges for multi-level sorting

Return values
mixed

The sorted values from the sort range

validateInt()

public static validateInt(mixed $value) : int
Parameters
$value : mixed
Return values
int

validatePositiveInt()

public static validatePositiveInt(mixed $value[, bool $allowZero = true ]) : int
Parameters
$value : mixed
$allowZero : bool = true
Return values
int

buildVectorForSort()

private static buildVectorForSort(array<string|int, mixed> $sortArray, array<string|int, int> $sortIndex, array<string|int, int> $sortOrder) : array<string|int, mixed>
Parameters
$sortArray : array<string|int, mixed>
$sortIndex : array<string|int, int>
$sortOrder : array<string|int, int>
Return values
array<string|int, mixed>

enumerateArrayKeys()

private static enumerateArrayKeys(array<string|int, mixed> $sortArray) : array<string|int, mixed>
Parameters
$sortArray : array<string|int, mixed>
Return values
array<string|int, mixed>

executeVectorSortQuery()

private static executeVectorSortQuery(array<string|int, mixed> $sortData, array<string|int, mixed> $sortArguments) : array<string|int, mixed>
Parameters
$sortData : array<string|int, mixed>
$sortArguments : array<string|int, mixed>
Return values
array<string|int, mixed>

prepareSortVectorValues()

private static prepareSortVectorValues(array<string|int, mixed> $sortVector) : array<string|int, mixed>
Parameters
$sortVector : array<string|int, mixed>
Return values
array<string|int, mixed>

processSortBy()

private static processSortBy(array<string|int, mixed> $sortArray, array<string|int, array<string|int, mixed>> $sortIndex, array<string|int, int> $sortOrder) : array<string|int, mixed>
Parameters
$sortArray : array<string|int, mixed>
$sortIndex : array<string|int, array<string|int, mixed>>
$sortOrder : array<string|int, int>
Return values
array<string|int, mixed>

sortByColumn()

private static sortByColumn(array<string|int, mixed> $sortArray, array<string|int, int> $sortIndex, array<string|int, int> $sortOrder) : array<string|int, mixed>
Parameters
$sortArray : array<string|int, mixed>
$sortIndex : array<string|int, int>
$sortOrder : array<string|int, int>
Return values
array<string|int, mixed>

sortByRow()

private static sortByRow(array<string|int, mixed> $sortArray, array<string|int, int> $sortIndex, array<string|int, int> $sortOrder) : array<string|int, mixed>
Parameters
$sortArray : array<string|int, mixed>
$sortIndex : array<string|int, int>
$sortOrder : array<string|int, int>
Return values
array<string|int, mixed>

sortLookupArrayFromVector()

private static sortLookupArrayFromVector(array<string|int, mixed> $sortArray, array<string|int, mixed> $sortVector) : array<string|int, mixed>
Parameters
$sortArray : array<string|int, mixed>
$sortVector : array<string|int, mixed>
Return values
array<string|int, mixed>

validateArrayArgumentsForSort()

private static validateArrayArgumentsForSort(array<string|int, mixed> &$sortIndex, mixed &$sortOrder, int $sortArraySize) : void
Parameters
$sortIndex : array<string|int, mixed>
$sortOrder : mixed
$sortArraySize : int

validateScalarArgumentsForSort()

private static validateScalarArgumentsForSort(mixed &$sortIndex, mixed &$sortOrder, int $sortArraySize) : void
Parameters
$sortIndex : mixed
$sortOrder : mixed
$sortArraySize : int

validateSortOrder()

private static validateSortOrder(mixed $sortOrder) : int
Parameters
$sortOrder : mixed
Return values
int

validateSortVector()

private static validateSortVector(mixed $sortVector, int $sortArraySize) : array<string|int, mixed>
Parameters
$sortVector : mixed
$sortArraySize : int
Return values
array<string|int, mixed>

        
On this page

Search results