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