class ReverseZoneSorting (View source)

Class ReverseZoneSorting

Provides multiple sorting algorithms for reverse DNS zones:

  1. Natural sorting (default): Based on natural sorting of domain names
  2. Hierarchical sorting: Organizes zones by network hierarchy prioritizing by the base network first (10.in-addr.arpa, 172.in-addr.arpa, etc.) and then by the specific subnets within each network.

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

Array of domain names to sort

string $sortType

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

Return Value

array

Sorted array of domain names