Total Complexity | 7 |
Total Lines | 97 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class JpPrefecture |
||
12 | { |
||
13 | /** |
||
14 | * @param $code |
||
15 | * @return \JpPrefecture\PrefectureInterface |
||
16 | * @throws \JpPrefecture\Exception\InvalidPrefectureException |
||
17 | */ |
||
18 | public static function get($code) |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @param $code |
||
31 | * @return bool |
||
32 | */ |
||
33 | public static function exists($code) |
||
40 | } |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @return \JpPrefecture\PrefectureInterface[] |
||
45 | */ |
||
46 | public static function all() |
||
47 | { |
||
48 | $prefectures = self::asList(); |
||
49 | |||
50 | return array_map(function ($code, $name) { |
||
51 | return new Prefecture($code, $name); |
||
52 | }, array_keys($prefectures), $prefectures); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return array |
||
57 | */ |
||
58 | public static function asList() |
||
108 | ); |
||
109 | } |
||
110 | } |