Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — master ( 5c7169...b34131 )
by Mark
08:19 queued 05:45
created

Global.php ➔ segmentRequestPath()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
    /**
4
     * Return the auth account instance class.
5
     *
6
     * @return \App\Model\Account|\Illuminate\Contracts\Auth\Authenticatable
7
     */
8
    function account()
9
    {
10
        return auth()->user();
0 ignored issues
show
Bug introduced by
The method user does only exist in Illuminate\Contracts\Auth\Guard, but not in Illuminate\Contracts\Auth\Factory.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
11
    }
12
13
    /**
14
     * Return the webshelf framework version.
15
     *
16
     * @return App\Framework
17
     */
18
    function framework()
19
    {
20
        return app(App\Framework::class);
21
    }
22
23
    /**
24
     * @return \App\Classes\SettingsManager
25
     */
26
    function settings()
27
    {
28
        return app(\App\Classes\SettingsManager::class);
29
    }
30
31
    /**
32
     * @return \App\Classes\PluginManager
33
     */
34
    function plugins()
35
    {
36
        return app(\App\Classes\PluginManager::class);
37
    }
38
39
    /**
40
     * @return \App\Classes\Library\StyleCSS\Style
41
     */
42
    function css()
43
    {
44
        return app(\App\Classes\Library\StyleCSS\Style::class);
45
    }
46
47
    function currentURI()
48
    {
49
        $route = basename(request()->path()) ?: 'index';
50
51
        return $route != '' ? $route : 'index';
52
    }
53
54
    /**
55
     * Return an array of the segmented url path.
56
     *
57
     * @return array
58
     */
59
    function segmentRequestPath()
60
    {
61
        $path = app('request')->path();
62
63
        if ($path == '/') {
64
            return ['index'];
65
        }
66
67
        return explode('/', $path);
68
    }
69
70
    /**
71
     * Turn a boolean value into readable data.
72
     * true  = Active
73
     * false = Inactive.
74
     *
75
     * @param $boolean
76
     * @param null $trueMessage
77
     * @param null $falseMessage
78
     * @return string
79
     * @internal param null $true
80
     * @internal param null $false
81
     * @deprecated
82
     */
83
    function bool2Status($boolean, $trueMessage = null, $falseMessage = null)
84
    {
85
        if ($boolean == true) {
86
            return '<span class="status green">'.($trueMessage ?: 'Active').'</span>';
87
        } else {
88
            return '<span class="status red">'.($falseMessage ?: 'Inactive').'</span>';
89
        }
90
    }
91