Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
CountryCodes | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
countryCodeIsValid | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCountryCodesNames | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | /** |
6 | * @author: Doug Wilbourne (dougwilbourne@gmail.com) |
7 | */ |
8 | |
9 | namespace pvc\intl; |
10 | |
11 | use pvc\interfaces\intl\CountryCodesInterface; |
12 | use Symfony\Component\Intl\Countries; |
13 | |
14 | /** |
15 | * Class CountryCodes |
16 | */ |
17 | class CountryCodes implements CountryCodesInterface |
18 | { |
19 | /** |
20 | * countryCodeIsValid |
21 | * @param string $code |
22 | * @return bool |
23 | */ |
24 | public static function countryCodeIsValid(string $code): bool |
25 | { |
26 | return array_key_exists($code, self::getCountryCodesNames()); |
27 | } |
28 | |
29 | /** |
30 | * getCountryCodesNames |
31 | * @return array<string, string> |
32 | */ |
33 | public static function getCountryCodesNames(): array |
34 | { |
35 | return Countries::getNames(); |
36 | } |
37 | } |