/** * Sets the directions response status. * * @param string $status The directions response status. * * @throws \Ivory\GoogleMap\Exception\DirectionsException If the status is not valid. */ public function setStatus($status) { if (!in_array($status, DirectionsStatus::getDirectionsStatus())) { throw DirectionsException::invalidDirectionsResponseStatus(); } $this->status = $status; }
/** * Gets the "INVALID DIRECTIONS RESPONSE STATUS" exception. * * @return \Ivory\GoogleMap\Exception\DirectionsException The "INVALID DIRECTIONS RESPONSE STATUS" exception. */ public static function invalidDirectionsResponseStatus() { return new static(sprintf('The directions response status can only be : %s.', implode(', ', DirectionsStatus::getDirectionsStatus()))); }
public function testDirectionsStatus() { $expected = array(DirectionsStatus::INVALID_REQUEST, DirectionsStatus::MAX_WAYPOINTS_EXCEEDED, DirectionsStatus::NOT_FOUND, DirectionsStatus::OK, DirectionsStatus::OVER_QUERY_LIMIT, DirectionsStatus::REQUEST_DENIED, DirectionsStatus::UNKNOWN_ERROR, DirectionsStatus::ZERO_RESULTS); $this->assertSame($expected, DirectionsStatus::getDirectionsStatus()); }