/** * Sets the geometry location type. * * @param string $locationType The geometry location type. * * @throws \Ivory\GoogleMap\Exception\GeocodingException If the location type is not valid. */ public function setLocationType($locationType) { if (!in_array($locationType, GeocoderLocationType::getGeocoderLocationTypes())) { throw GeocodingException::invalidGeocoderLocationType(); } $this->locationType = $locationType; }
public function testGeocoderLocationtypes() { $expected = array(GeocoderLocationType::APPROXIMATE, GeocoderLocationType::GEOMETRIC_CENTER, GeocoderLocationType::RANGE_INTERPOLATED, GeocoderLocationType::ROOFTOP); $this->assertSame($expected, GeocoderLocationType::getGeocoderLocationTypes()); }
/** * Gets the "INVALID GEOCODER LOCATION TYPE" exception. * * @return \Ivory\GoogleMap\Exception\GeocodingException The "INVALID GEOCODER LOCATION TYPE" exception. */ public static function invalidGeocoderLocationType() { return new static(sprintf('The geocoder geometry location type can only be : %s.', implode(', ', GeocoderLocationType::getGeocoderLocationTypes()))); }