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.

TranslatedRouteCommandContext::getBootstrapPath()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Mcamara\LaravelLocalization\Traits;
4
5
trait TranslatedRouteCommandContext
6
{
7
    /**
8
     * Returns whether a given locale is supported.
9
     *
10
     * @param string $locale
11
     * @return bool
12
     */
13
    protected function isSupportedLocale($locale)
14
    {
15
        return in_array($locale, $this->getSupportedLocales());
16
    }
17
18
    /**
19
     * @return string[]
20
     */
21
    protected function getSupportedLocales()
22
    {
23
        return $this->getLaravelLocalization()->getSupportedLanguagesKeys();
24
    }
25
26
    /**
27
     * @return \Mcamara\LaravelLocalization\LaravelLocalization
28
     */
29
    protected function getLaravelLocalization()
30
    {
31
        return $this->laravel->make('laravellocalization');
0 ignored issues
show
Bug introduced by
The property laravel does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    protected function getBootstrapPath()
38
    {
39
        if (method_exists($this->laravel, 'bootstrapPath')) {
40
            return $this->laravel->bootstrapPath();
41
        }
42
43
        return $this->laravel->basePath() . DIRECTORY_SEPARATOR . 'bootstrap';
44
    }
45
46
    /**
47
     * @param string $locale
48
     * @return string
49
     */
50
    protected function makeLocaleRoutesPath($locale = '')
51
    {
52
        $path = $this->laravel->getCachedRoutesPath();
53
54
        if ( ! $locale ) {
55
            return $path;
56
        }
57
58
        return substr($path, 0, -4) . '_' . $locale . '.php';
59
    }
60
}
61