1 <?php declare(strict_types=1);
23 $this->order[$subject] = $direction;
28 if (array_key_exists($subject, $this->order)) {
29 throw new \InvalidArgumentException(
"already sorted by subject '$subject'", 1);
35 if ($direction !== self::ASC && $direction !== self::DESC) {
36 throw new \InvalidArgumentException(
"Direction bust be Order::ASC or Order::DESC.", 1);
45 $clone->order[$subject] = $direction;
49 public function get() : array
54 public function join($init, callable $fn)
57 foreach ($this->order as $key => $value) {
checkDirection($direction)
join($init, callable $fn)
checkSubject(string $subject)
Both the subject and the direction need to be specified when expressing an order. ...
__construct(string $subject, $direction)
append(string $subject, $direction)