class ReverseZoneSorting implements ReverseZoneSorterInterface (View source)

Picks natural or hierarchical reverse zone sorting per the configured sort type, in SQL or in PHP.

Methods

string
getSortOrder(string $field, string $dbType, string $direction = 'ASC', string $sortType = 'natural')

Get the appropriate SQL sort order clause based on the configuration setting.

array
sortDomains(array $domains, string $sortType = 'natural')

Sort reverse zone domain names using the specified algorithm.

Details

string getSortOrder(string $field, string $dbType, string $direction = 'ASC', string $sortType = 'natural')

Get the appropriate SQL sort order clause based on the configuration setting.

Parameters

string $field

The full field name to sort (e.g., "domains.name")

string $dbType

The database type ('mysql', 'mysqli', 'pgsql', 'sqlite')

string $direction

Sort direction ('ASC' or 'DESC')

string $sortType

The type of sorting to use ('natural' or 'hierarchical')

Return Value

string

SQL ORDER BY clause for the specified sorting method

array sortDomains(array $domains, string $sortType = 'natural')

Sort reverse zone domain names using the specified algorithm.

Parameters

array $domains

Reverse zone names

string $sortType

'natural' or 'hierarchical'

Return Value

array

The same names in sorted order