isValidCountry() public static method

Checks if the given value is a valid country
public static isValidCountry ( string $country ) : boolean
$country string
return boolean
Beispiel #1
0
 /**
  * Sets and validates the country
  *
  * @param string $country
  *
  * @return \ApaiIO\Configuration\GenericConfiguration
  */
 public function setCountry($country)
 {
     if (!Country::isValidCountry($country)) {
         throw new \InvalidArgumentException(sprintf("Invalid Country-Code: %s! Possible Country-Codes: %s", $country, implode(', ', Country::getCountries())));
     }
     $this->country = strtolower($country);
     return $this;
 }
Beispiel #2
0
 public function testValidCountry()
 {
     $this->assertTrue(Country::isValidCountry('com'));
 }
 /**
  * Sets an validates the country
  *
  * @param string $country
  *
  * @return \ApaiIO\Configuration\GenericConfiguration
  */
 public function setCountry($country)
 {
     Country::isValidCountry($country);
     $this->country = strtolower($country);
     return $this;
 }