public function route()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0] instanceof DirectionsRequest)) {
            $directionsRequest = $args[0];
        } elseif ((isset($args[0]) && is_string($args[0])) && (isset($args[1]) && is_string($args[1]))) {
            $directionsRequest = new DirectionsRequest();

            $directionsRequest->setOrigin($args[0]);
            $directionsRequest->setDestination($args[1]);
        } else {
            throw DirectionsException::invalidDirectionsRequestParameters();
        }

        if (!$directionsRequest->isValid()) {
            throw DirectionsException::invalidDirectionsRequest();
        }

        $response = $this->send($this->generateUrl($directionsRequest));
        $directionsResponse = $this->buildDirectionsResponse($this->parse($response->getBody()));

        return $directionsResponse;
    }
public function route()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0] instanceof DirectionsRequest)) {
            $directionsRequest = $args[0];
        } elseif ((isset($args[0]) && is_string($args[0])) && (isset($args[1]) && is_string($args[1]))) {
            $directionsRequest = new DirectionsRequest();

            $directionsRequest->setOrigin($args[0]);
            $directionsRequest->setDestination($args[1]);
        } else {
            throw DirectionsException::invalidDirectionsRequestParameters();
        }

        if (!$directionsRequest->isValid()) {
            throw DirectionsException::invalidDirectionsRequest();
        }

        $response = $this->send($this->generateUrl($directionsRequest));
        $directionsResponse = $this->buildDirectionsResponse($this->parse($response->getBody()));

        return $directionsResponse;
    }
public function route ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && ( $ args [ 0 ] instanceof DirectionsRequest ) ) { $ directionsRequest = $ args [ 0 ] ; } elseif ( ( isset ( $ args [ 0 ] ) && is_string ( $ args [ 0 ] ) ) && ( isset ( $ args [ 1 ] ) && is_string ( $ args [ 1 ] ) ) ) { $ directionsRequest = new DirectionsRequest ( ) ; $ directionsRequest -> setOrigin ( $ args [ 0 ] ) ; $ directionsRequest -> setDestination ( $ args [ 1 ] ) ; } else { throw DirectionsException :: invalidDirectionsRequestParameters ( ) ; } if ( ! $ directionsRequest -> isValid ( ) ) { throw DirectionsException :: invalidDirectionsRequest ( ) ; } $ response = $ this -> send ( $ this -> generateUrl ( $ directionsRequest ) ) ; $ directionsResponse = $ this -> buildDirectionsResponse ( $ this -> parse ( $ response -> getBody ( ) ) ) ; return $ directionsResponse ; }
Routes the given request.

Available prototypes:
- function route(string $origin, string $destination)
- function route(Ivory\GoogleMap\Services\Directions\DirectionsRequest $request)

@throws \Ivory\GoogleMap\Exception\DirectionsException If the request is not valid (prototypes).
Routes the given request .