orderBy = $order; return $this; } public function add(string $field, ? string $direction = null) : self { $this->orderBy[] = [ $field, $direction ]; return $this; } public function render() : string { $list = array_map(function($item) { list($field, $direction) = $item; return $field . ( $direction ? " $direction" : "" ); }, $this->orderBy); return $this->renderSegments([ static::SQL_TOKEN, implode(", ", $list) ]); } }