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 ( ee15e1...d26226 )
by Mark
03:59
created

Global.php ➔ dumpVar()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
    function dumpVar()
4
    {
5
        array_map(function ($x) {
6
            (new \Illuminate\Support\Debug\Dumper())->dump($x);
7
        }, func_get_args());
8
    }
9
10
    /**
11
     * Return the auth account instance class.
12
     *
13
     * @return \App\Model\Account|\Illuminate\Contracts\Auth\Authenticatable
14
     */
15
    function account()
16
    {
17
        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...
18
    }
19
20
    /**
21
     * Get the path to the dashboard folder.
22
     *
23
     * @param  string  $path
24
     * @return string
25
     */
26
    function dashboard_path($path = '')
0 ignored issues
show
Coding Style introduced by
As per coding-style, this function should be in camelCase.

CamelCase (...) is the practice of writing compound words or phrases such that
each word or abbreviation begins with a capital letter.

Learn more about camelCase.

Loading history...
27
    {
28
        return app()->make('path.dashboard').($path ? DIRECTORY_SEPARATOR.$path : $path);
29
    }
30
31
    /**
32
     * Return the webshelf framework version.
33
     *
34
     * @return App\Framework
35
     */
36
    function framework()
37
    {
38
        return app(App\Framework::class);
39
    }
40
41
    /**
42
     * @return \App\Classes\PopupQueue
43
     */
44
    function popups()
45
    {
46
        return app(App\Classes\PopupQueue::class);
47
    }
48
49
    /**
50
     * @return \App\Classes\SettingsManager
51
     */
52
    function settings()
53
    {
54
        return app(\App\Classes\SettingsManager::class);
55
    }
56
57
    /**
58
     * @return \App\Classes\PluginManager
59
     */
60
    function plugins()
61
    {
62
        return app(\App\Classes\PluginManager::class);
63
    }
64
65
    function makeSlug(\App\Model\Page $page)
66
    {
67
        try {
68
            if ($page->menu) {
69
                if ($page->menu->parent) {
70
                    return $page->menu->parent->slug.'/'.$page->slug;
71
                }
72
            }
73
        } catch (\Exception $e) {
0 ignored issues
show
Unused Code introduced by
catch (\Exception $e) { ...age ' . $page->slug); } does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
74
            throw new \Exception('Unexpected error occurred for url creation of the page '.$page->slug);
75
        }
76
77
        return $page->slug;
78
    }
79
80
    function makeUrl(\App\Model\Page $page)
81
    {
82
        return url(makeSlug($page));
83
    }
84
85
    /**
86
     * Turn a boolean value into readable data.
87
     * true  = Active
88
     * false = Inactive.
89
     *
90
     * @param $boolean
91
     * @param null $trueMessage
92
     * @param null $falseMessage
93
     * @return string
94
     * @internal param null $true
95
     * @internal param null $false
96
     */
97
    function bool2Status($boolean, $trueMessage = null, $falseMessage = null)
98
    {
99
        if ($boolean == true) {
100
            return '<span class="status green">'.($trueMessage ?: 'Active').'</span>';
101
        } else {
102
            return '<span class="status red">'.($falseMessage ?: 'Inactive').'</span>';
103
        }
104
    }
105
106
    function currentURI()
107
    {
108
        $route = basename(request()->path()) ?: 'index';
109
110
        return $route != '' ? $route : 'index';
111
    }
112