GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

getTranslationsForTranslationLoaders()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Spatie\TranslationLoader;
4
5
use Illuminate\Translation\FileLoader;
6
use Spatie\TranslationLoader\TranslationLoaders\TranslationLoader;
7
8
class TranslationLoaderManager extends FileLoader
9
{
10
    /**
11
     * Load the messages for the given locale.
12
     *
13
     * @param string $locale
14
     * @param string $group
15
     * @param string $namespace
16
     *
17
     * @return array
18
     */
19
    public function load($locale, $group, $namespace = null): array
20
    {
21
        $fileTranslations = parent::load($locale, $group, $namespace);
22
23
        if (! is_null($namespace) && $namespace !== '*') {
24
            return $fileTranslations;
25
        }
26
27
        $loaderTranslations = $this->getTranslationsForTranslationLoaders($locale, $group, $namespace);
28
29
        return array_replace_recursive($fileTranslations, $loaderTranslations);
30
    }
31
32
    protected function getTranslationsForTranslationLoaders(
33
        string $locale,
34
        string $group,
35
        string $namespace = null
36
    ): array {
37
        return collect(config('translation-loader.translation_loaders'))
38
            ->map(function (string $className) {
39
                return app($className);
40
            })
41
            ->mapWithKeys(function (TranslationLoader $translationLoader) use ($locale, $group, $namespace) {
42
                return $translationLoader->loadTranslations($locale, $group, $namespace);
0 ignored issues
show
Unused Code introduced by
The call to TranslationLoader::loadTranslations() has too many arguments starting with $namespace.

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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
43
            })
44
            ->toArray();
45
    }
46
}
47