| 1 | <?php |
||
| 13 | class MappingFileProvider |
||
| 14 | { |
||
| 15 | protected $map; |
||
| 16 | |||
| 17 | 253 | public function __construct($map) |
|
| 21 | |||
| 22 | 25 | public function getFileName($countryCallingCode, $language, $script, $region) |
|
|
|
|||
| 23 | { |
||
| 24 | 25 | if (strlen($language) == 0) { |
|
| 25 | return ""; |
||
| 26 | } |
||
| 27 | |||
| 28 | 25 | if ($language === 'zh' && ($region == 'TW' || $region == 'HK' || $region == 'MO')) { |
|
| 29 | 1 | $language = 'zh_Hant'; |
|
| 30 | } |
||
| 31 | |||
| 32 | // Loop through the $countryCallingCode and load the prefix |
||
| 33 | 25 | $prefixLength = strlen($countryCallingCode); |
|
| 34 | |||
| 35 | 25 | for ($i = $prefixLength; $i > 0; $i--) { |
|
| 36 | 25 | $prefix = substr($countryCallingCode, 0, $i); |
|
| 37 | 25 | if ($this->inMap($language, $prefix)) { |
|
| 38 | 21 | return $language . DIRECTORY_SEPARATOR . $prefix . '.php'; |
|
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | 9 | return ""; |
|
| 43 | } |
||
| 44 | |||
| 45 | 25 | protected function inMap($language, $countryCallingCode) |
|
| 49 | } |
||
| 50 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.