ApaiIO\Configuration\Country::isValidCountry PHP Метод

isValidCountry() публичный статический метод

Checks if the given value is a valid country
public static isValidCountry ( string $country ) : boolean
$country string
Результат boolean
    public static function isValidCountry($country)
    {
        $isValid = in_array(strtolower($country), self::$countryList) ? true : false;
        return $isValid;
    }

Usage Example

Пример #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;
 }
All Usage Examples Of ApaiIO\Configuration\Country::isValidCountry