19declare(strict_types=1);
28 protected function applyOrder(array
$data, ?Order $order =
null): array
30 if ($order !==
null) {
31 $order_field = array_keys($order->get())[0];
32 $order_direction = $order->get()[$order_field];
34 if (count(array_column(
$data, $order_field)) === 0) {
38 array_column(
$data, $order_field),
39 $order_direction ===
'ASC' ? SORT_ASC : SORT_DESC,
40 $this->isFieldNumeric($order_field) ? SORT_NUMERIC : SORT_STRING,
47 protected function applyRange(array
$data, ?Range
$range =
null): array
Both the subject and the direction need to be specified when expressing an order.
A simple class to express a naive range of whole positive numbers.