PHP Класс LdapTools\Query\LdapResultSorter

Автор: Chad Sikorra ([email protected])
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$aliases LdapTools\Schema\LdapObjectSchema[]
$caseSensitive boolean
$orderBy array

Открытые методы

Метод Описание
__construct ( array $orderBy = [], array $aliases = [] )
getIsCaseSensitive ( ) : boolean Get whether or not the results will be sorted case-sensitive.
setIsCaseSensitive ( boolean $caseSensitive ) Set whether or not the results will be sorted case-sensitive.
sort ( array | LdapObjectCollection $results ) : array | LdapObjectCollection Reorganize the array to the desired orderBy methods passed to the class.

Защищенные методы

Метод Описание
compare ( string $value1, string $value2 ) : integer Taking into account case-sensitivity compare the 2 string values.
convertValueToString ( mixed $value ) : string Certain cases may require the value to be specifically changed to a string, as not every object has default string representation. The most common wanting to be sorted would likely be a DateTime object.
getComparisonValue ( array | LdapObject $entry, string $attribute ) : mixed Determine how to get the value for the attribute from the LDAP entry being compared, and return that value.
getUsortReturnValue ( string $attribute, string $direction, array | LdapObject $a, array | LdapObject $b ) : integer Based on the attribute and direction, compare the LDAP objects to get a return value for usort.
resultSortCallback ( mixed $a, mixed $b ) : integer Goes through each orderBy value to run a comparison to determine the value to pass back to usort.

Описание методов

__construct() публичный метод

public __construct ( array $orderBy = [], array $aliases = [] )
$orderBy array
$aliases array The aliases used, if any (in the form of ['alias' => LdapObjectSchema])

compare() защищенный метод

Taking into account case-sensitivity compare the 2 string values.
protected compare ( string $value1, string $value2 ) : integer
$value1 string
$value2 string
Результат integer

convertValueToString() защищенный метод

Certain cases may require the value to be specifically changed to a string, as not every object has default string representation. The most common wanting to be sorted would likely be a DateTime object.
protected convertValueToString ( mixed $value ) : string
$value mixed
Результат string

getComparisonValue() защищенный метод

Determine how to get the value for the attribute from the LDAP entry being compared, and return that value.
protected getComparisonValue ( array | LdapObject $entry, string $attribute ) : mixed
$entry array | LdapTools\Object\LdapObject
$attribute string
Результат mixed

getIsCaseSensitive() публичный метод

Get whether or not the results will be sorted case-sensitive.
public getIsCaseSensitive ( ) : boolean
Результат boolean

getUsortReturnValue() защищенный метод

Based on the attribute and direction, compare the LDAP objects to get a return value for usort.
protected getUsortReturnValue ( string $attribute, string $direction, array | LdapObject $a, array | LdapObject $b ) : integer
$attribute string
$direction string
$a array | LdapTools\Object\LdapObject
$b array | LdapTools\Object\LdapObject
Результат integer

resultSortCallback() защищенный метод

Goes through each orderBy value to run a comparison to determine the value to pass back to usort.
protected resultSortCallback ( mixed $a, mixed $b ) : integer
$a mixed
$b mixed
Результат integer

setIsCaseSensitive() публичный метод

Set whether or not the results will be sorted case-sensitive.
public setIsCaseSensitive ( boolean $caseSensitive )
$caseSensitive boolean

sort() публичный метод

Reorganize the array to the desired orderBy methods passed to the class.
public sort ( array | LdapObjectCollection $results ) : array | LdapObjectCollection
$results array | LdapTools\Object\LdapObjectCollection The unsorted result set.
Результат array | LdapTools\Object\LdapObjectCollection The sorted result set.

Описание свойств

$aliases защищенное свойство

protected LdapObjectSchema[],LdapTools\Schema $aliases
Результат LdapTools\Schema\LdapObjectSchema[]

$caseSensitive защищенное свойство

protected bool $caseSensitive
Результат boolean

$orderBy защищенное свойство

protected array $orderBy
Результат array