by = $by; $this->direction = $direction; } public function es(): array { $sorting = []; if ($this->by) { $sorting['sort'] = [$this->by => $this->direction]; } return $sorting; } }