/** * Sets the geocoder results status. * * @param string $status The geocoder result status. * * @throws \Ivory\GoogleMap\Exception\GeocodingException If the status is not valid. */ public function setStatus($status) { if (!in_array($status, GeocoderStatus::getGeocoderStatus())) { throw GeocodingException::invalidGeocoderResponseStatus(); } $this->status = $status; }
/** * Gets the "INVALID GEOCODER RESPONSE STATUS" exception. * * @return \Ivory\GoogleMap\Exception\GeocodingException The "INVALID GEOCODER RESPONSE STATUS" exception. */ public static function invalidGeocoderResponseStatus() { return new static(sprintf('The geocoder response status can only be : %s.', implode(', ', GeocoderStatus::getGeocoderStatus()))); }
public function testGeocoderStatus() { $expected = array(GeocoderStatus::ERROR, GeocoderStatus::INVALID_REQUEST, GeocoderStatus::OK, GeocoderStatus::OVER_QUERY_LIMIT, GeocoderStatus::REQUEST_DENIED, GeocoderStatus::UNKNOWN_ERROR, GeocoderStatus::ZERO_RESULTS); $this->assertSame($expected, GeocoderStatus::getGeocoderStatus()); }