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;
    }
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;
    }
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 ; }
Sort by.

@param SortBy $sortBy

@return Query
Sort by .