/** * 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, DistanceMatrixStatus::getDistanceMatrixStatus())) { throw DistanceMatrixException::invalidDistanceMatrixResponseStatus(); } $this->status = $status; }
/** * Gets the "INVALID DISTANCE MATRIX RESPONSE STATUS" exception. * * @return \Ivory\GoogleMap\Exception\DistanceMatrixException The "INVALID DISTANCE MATRIX RESPONSE STATUS" exception. */ public static function invalidDistanceMatrixResponseStatus() { return new static(sprintf('The distance matrix response status can only be : %s.', implode(', ', DistanceMatrixStatus::getDistanceMatrixStatus()))); }
public function testDistanceMatrixStatus() { $expected = array(DistanceMatrixStatus::INVALID_REQUEST, DistanceMatrixStatus::MAX_DIMENSIONS_EXCEEDED, DistanceMatrixStatus::MAX_ELEMENTS_EXCEEDED, DistanceMatrixStatus::OK, DistanceMatrixStatus::OVER_QUERY_LIMIT, DistanceMatrixStatus::REQUEST_DENIED, DistanceMatrixStatus::UNKNOWN_ERROR); $this->assertSame($expected, DistanceMatrixStatus::getDistanceMatrixStatus()); }