Total Complexity | 4 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class TranslationLoaderManager extends FileLoader |
||
8 | { |
||
9 | /** |
||
10 | * Load the messages for the given locale. |
||
11 | * |
||
12 | * @param string $locale |
||
13 | * @param string $group |
||
14 | * @param string $namespace |
||
15 | * |
||
16 | * @return array |
||
17 | */ |
||
18 | public function load($locale, $group, $namespace = null): array |
||
19 | { |
||
20 | $fileTranslations = parent::load($locale, $group, $namespace); |
||
21 | |||
22 | if (! is_null($namespace) && '*' !== $namespace) { |
||
23 | return $fileTranslations; |
||
24 | } |
||
25 | |||
26 | $loaderTranslations = $this->getTranslationsForTranslationLoaders($locale, $group, $namespace); |
||
27 | |||
28 | return array_replace_recursive($fileTranslations, $loaderTranslations); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param string $locale |
||
33 | * @param string $group |
||
34 | * @param string|null $namespace |
||
35 | * |
||
36 | * @return array |
||
37 | */ |
||
38 | protected function getTranslationsForTranslationLoaders( |
||
51 | } |
||
52 | } |
||
53 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.