/**
  * Sets the distance matrix response status.
  *
  * @param string $status The distance matrix status.
  *
  * @throws \Ivory\GoogleMap\Exception\DistanceMatrixException If the status is not valid.
  */
 public function setStatus($status)
 {
     if (!in_array($status, DistanceMatrixElementStatus::getDistanceMatrixElementStatus())) {
         throw DistanceMatrixException::invalidDistanceMatrixResponseElementStatus();
     }
     $this->status = $status;
 }
 /**
  * Processes the given request.
  *
  * Available prototypes:
  * - function process(array $origins, array $destinations)
  * - function process(Ivory\GoogleMap\Services\DistanceMatrix\DistanceMatrixRequest $request)
  *
  * @throws \Ivory\GoogleMap\Exception\DistanceMatrixException If the request is not valid (prototypes).
  */
 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;
 }
 /**
  * Sets the distance matrix request sensor.
  *
  * @param boolean $sensor TRUE if the distance matrix request has a sensor else FALSE.
  *
  * @throws \Ivory\GoogleMap\Exception\DistanceMatrixException If the sensor flag is not valid.
  */
 public function setSensor($sensor)
 {
     if (!is_bool($sensor)) {
         throw DistanceMatrixException::invalidDistanceMatrixRequestSensor();
     }
     $this->sensor = $sensor;
 }