/**
  * Gets the "INVALID AUTOCOMPLETE COMPONENT RESTRICTION" exception.
  *
  * @return \Ivory\GoogleMap\Exception\PlaceException The "INVALID AUTOCOMPLETE COMPONENT RESTRICTION" exception.
  */
 public static function invalidAutocompleteComponentRestriction()
 {
     return new static(sprintf('The place autocomplete component restriction can only be: %s.', implode(', ', AutocompleteComponentRestriction::getAvailableAutocompleteComponentRestrictions())));
 }
 /**
  * Adds a component restriction.
  *
  * @param string $type  The component restriction type.
  * @param mixed  $value The component restriction value.
  *
  * @throws \Ivory\GoogleMap\Exception\PlaceException If the component restriction type is not supported.
  * @throws \Ivory\GoogleMap\Exception\PlaceException If the component restriction type already exists.
  */
 public function addComponentRestriction($type, $value)
 {
     if (!in_array($type, AutocompleteComponentRestriction::getAvailableAutocompleteComponentRestrictions())) {
         throw PlaceException::invalidAutocompleteComponentRestriction();
     }
     if ($this->hasComponentRestriction($type)) {
         throw PlaceException::autocompleteComponentRestrictionAlreadyExists($type);
     }
     $this->componentRestrictions[$type] = $value;
 }
 public function testAutocompleteComponentRestrictions()
 {
     $this->assertSame(array(AutocompleteComponentRestriction::COUNTRY), AutocompleteComponentRestriction::getAvailableAutocompleteComponentRestrictions());
 }