public function sortBy(SortBy $sortBy): self
    {
        if ($sortBy->isSortedByGeoDistance()) {
            if (!$this->coordinate instanceof Coordinate) {
                throw InvalidFormatException::querySortedByDistanceWithoutCoordinate();
            }

            $sortBy->setCoordinate($this->coordinate);
        }

        $this->sortBy = $sortBy;

        return $this;
    }