1 | <?php |
||
19 | final class Language |
||
20 | { |
||
21 | |||
22 | private static $codes; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $language; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $languageCode; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | private $regionName; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | private $regionCode; |
||
43 | |||
44 | /** |
||
45 | * Language |
||
46 | * |
||
47 | * @param string $code |
||
48 | */ |
||
49 | public function __construct($code) |
||
58 | |||
59 | /** |
||
60 | * @inheritdoc |
||
61 | */ |
||
62 | public function __toString() |
||
66 | |||
67 | /** |
||
68 | * Get language name |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | public function language() |
||
76 | |||
77 | /** |
||
78 | * Get ISO 639-1 2 letter language code |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function languageCode() |
||
86 | |||
87 | /** |
||
88 | * Get region name |
||
89 | * |
||
90 | * @return mixed |
||
91 | */ |
||
92 | public function regionName() |
||
96 | |||
97 | /** |
||
98 | * Get region 2 letter country code |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | public function regionCode() |
||
106 | |||
107 | /** |
||
108 | * Clears the name of passed region |
||
109 | * |
||
110 | * @param string $regName |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | private function clear($regName) |
||
123 | |||
124 | /** |
||
125 | * Get language code |
||
126 | * |
||
127 | * @param string $code |
||
128 | * |
||
129 | * @return array |
||
130 | */ |
||
131 | private static function parseLanguage($code) |
||
144 | |||
145 | /** |
||
146 | * Get regina name and code |
||
147 | * |
||
148 | * @param string $code |
||
149 | * |
||
150 | * @return array |
||
151 | */ |
||
152 | private static function parseRegion($code) |
||
167 | |||
168 | /** |
||
169 | * Language database |
||
170 | * |
||
171 | * @return array |
||
172 | */ |
||
173 | private static function codes() |
||
180 | |||
181 | /** |
||
182 | * Get the language RFC 3066 identifier |
||
183 | * |
||
184 | * @return string |
||
185 | */ |
||
186 | public function identifier() |
||
190 | } |