@@ -5,39 +5,39 @@ |
||
| 5 | 5 | |
| 6 | 6 | trait ParsesCountries |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Determine whether the given country code is valid. |
|
| 10 | - * |
|
| 11 | - * @param string $country |
|
| 12 | - * @return bool |
|
| 13 | - */ |
|
| 14 | - public static function isValidCountryCode($country) |
|
| 15 | - { |
|
| 16 | - $iso3166 = new ISO3166; |
|
| 8 | + /** |
|
| 9 | + * Determine whether the given country code is valid. |
|
| 10 | + * |
|
| 11 | + * @param string $country |
|
| 12 | + * @return bool |
|
| 13 | + */ |
|
| 14 | + public static function isValidCountryCode($country) |
|
| 15 | + { |
|
| 16 | + $iso3166 = new ISO3166; |
|
| 17 | 17 | |
| 18 | - try { |
|
| 19 | - $iso3166->alpha2($country); |
|
| 18 | + try { |
|
| 19 | + $iso3166->alpha2($country); |
|
| 20 | 20 | |
| 21 | - return true; |
|
| 22 | - } catch (\Exception $e) { |
|
| 23 | - return false; |
|
| 24 | - } |
|
| 25 | - } |
|
| 21 | + return true; |
|
| 22 | + } catch (\Exception $e) { |
|
| 23 | + return false; |
|
| 24 | + } |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Parse the provided phone countries to a valid array. |
|
| 29 | - * |
|
| 30 | - * @param string|array $countries |
|
| 31 | - * @return array |
|
| 32 | - */ |
|
| 33 | - protected function parseCountries($countries) |
|
| 34 | - { |
|
| 35 | - return Collection::make(is_array($countries) ? $countries : func_get_args()) |
|
| 36 | - ->map(function ($country) { |
|
| 37 | - return strtoupper($country); |
|
| 38 | - }) |
|
| 39 | - ->filter(function ($value) { |
|
| 40 | - return static::isValidCountryCode($value); |
|
| 41 | - })->toArray(); |
|
| 42 | - } |
|
| 27 | + /** |
|
| 28 | + * Parse the provided phone countries to a valid array. |
|
| 29 | + * |
|
| 30 | + * @param string|array $countries |
|
| 31 | + * @return array |
|
| 32 | + */ |
|
| 33 | + protected function parseCountries($countries) |
|
| 34 | + { |
|
| 35 | + return Collection::make(is_array($countries) ? $countries : func_get_args()) |
|
| 36 | + ->map(function ($country) { |
|
| 37 | + return strtoupper($country); |
|
| 38 | + }) |
|
| 39 | + ->filter(function ($value) { |
|
| 40 | + return static::isValidCountryCode($value); |
|
| 41 | + })->toArray(); |
|
| 42 | + } |
|
| 43 | 43 | } |
| 44 | 44 | \ No newline at end of file |