/**
  * Gets the "INVALID AUTOCOMPLETE TYPE" exception.
  *
  * @return \Ivory\GoogleMap\Exception\PlaceException The "INVALID AUTOCOMPLETE TYPE" exception.
  */
 public static function invalidAutocompleteType()
 {
     return new static(sprintf('The place autocomplete type can only be: %s.', implode(', ', AutocompleteType::getAvailableAutocompleteTypes())));
 }
 /**
  * Adds a type to the autocomplete.
  *
  * @param string $type The type to add.
  *
  * @throws \Ivory\GoogleMap\Exception\PlaceException If the type is not valid.
  * @throws \Ivory\GoogleMap\Exception\PlaceException If the type already exists.
  */
 public function addType($type)
 {
     if (!in_array($type, AutocompleteType::getAvailableAutocompleteTypes())) {
         throw PlaceException::invalidAutocompleteType();
     }
     if ($this->hasType($type)) {
         throw PlaceException::autocompleteTypeAlreadyExists($type);
     }
     $this->types[] = $type;
 }
 public function testAutocompleteTypes()
 {
     $this->assertSame(array(AutocompleteType::ESTABLISHMENT, AutocompleteType::GEOCODE, AutocompleteType::REGIONS, AutocompleteType::CITIES), AutocompleteType::getAvailableAutocompleteTypes());
 }