sortKeys.php
Table of Contents
Functions
- sortKeys() : string
- Composes a comma-separated sort expression in the textual sort grammar (the same grammar consumed by `SortTrait::prepareSort` and the HTTP `?sort=` query parameter).
Functions
sortKeys()
Composes a comma-separated sort expression in the textual sort grammar (the same grammar consumed by `SortTrait::prepareSort` and the HTTP `?sort=` query parameter).
sortKeys(string ...$keys) : string
Each argument is a sort token, typically produced by ascKey() or descKey() but plain field constants are accepted as well (an unprefixed key implies ascending order).
Null and empty tokens are skipped via compile(),
so callers can pass conditional tokens without array_filter() boilerplate.
Parameters
- $keys : string
-
One or more sort tokens (e.g.
'name','-created').
Tags
Return values
string —The comma-joined sort expression, or an empty string when no tokens are given.