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

        if (isset($args[0]) && ($args[0] instanceof DistanceMatrixRequest)) {
            $distanceMatrixRequest = $args[0];
        } elseif ((isset($args[0]) && is_array($args[0])) && (isset($args[1]) && is_array($args[1]))) {
            $distanceMatrixRequest = new DistanceMatrixRequest();

            $distanceMatrixRequest->setOrigins($args[0]);
            $distanceMatrixRequest->setDestinations($args[1]);
        } else {
            throw DistanceMatrixException::invalidDistanceMatrixRequestParameters();
        }

        if (!$distanceMatrixRequest->isValid()) {
            throw DistanceMatrixException::invalidDistanceMatrixRequest();
        }

        $response = $this->send($this->generateUrl($distanceMatrixRequest));
        $distanceMatrixResponse = $this->buildDistanceMatrixResponse($this->parse($response->getBody()));

        return $distanceMatrixResponse;
    }