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.

application.php ➔ env()   D
last analyzed

Complexity

Conditions 10
Paths 10

Size

Total Lines 25
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 110

Importance

Changes 0
Metric Value
cc 10
eloc 18
nc 10
nop 2
dl 0
loc 25
ccs 0
cts 17
cp 0
crap 110
rs 4.8196
c 0
b 0
f 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
use Nip\Container\Container;
4
5
if (!function_exists('app')) {
6
    /**
7
     * Get the available container instance.
8
     *
9
     * @param  string $make
10
     * @param  array $parameters
11
     * @return mixed|Container
12
     */
13
    function app($make = null, $parameters = [])
14
    {
15 28
        if (is_null($make)) {
16 1
            return Container::getInstance();
17
        }
18
19 28
        return Container::getInstance()->get($make, $parameters);
20
    }
21
}
22
23
if (!function_exists('env')) {
24
    /**
25
     * Gets the value of an environment variable.
26
     *
27
     * @param  string $key
28
     * @param  mixed $default
29
     * @return mixed
30
     */
31
    function env($key, $default = null)
32
    {
33
        $value = getenv($key);
34
        if ($value === false) {
35
            return value($default);
36
        }
37
        switch (strtolower($value)) {
38
            case 'true':
39
            case '(true)':
40
                return true;
41
            case 'false':
42
            case '(false)':
43
                return false;
44
            case 'empty':
45
            case '(empty)':
46
                return '';
47
            case 'null':
48
            case '(null)':
49
                return;
50
        }
51
//        if (strlen($value) > 1 && Str::startsWith($value, '"') && Str::endsWith($value, '"')) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
52
//            return substr($value, 1, -1);
53
//        }
54
        return $value;
55
    }
56
}
57
if (!function_exists('config')) {
58
    /**
59
     * Get / set the specified configuration value.
60
     *
61
     * If an array is passed as the key, we will assume you want to set an array of values.
62
     *
63
     * @param  array|string $key
64
     * @param  mixed $default
65
     * @return \Nip\Config\Config|mixed
66
     */
67
    function config($key = null, $default = null)
68
    {
69
        if (is_null($key)) {
70
            return app('config');
71
        }
72
        if (is_array($key)) {
73
            return app('config')->set($key);
74
        }
75
        return app('config')->get($key, $default);
76
    }
77
}
78
79
if (!function_exists('request')) {
80
    /**
81
     * Get an instance of the current request or an input item from the request.
82
     *
83
     * @param  array|string $key
84
     * @param  mixed $default
85
     * @return Nip\Request|string|array
86
     */
87
    function request($key = null, $default = null)
88
    {
89
        $request = app('request');
90
        if (is_null($key)) {
91
            return $request;
92
        }
93
        $value = $request->get($key);
94
        return $value ? $value : $default;
95
    }
96
}
97
98
if (!function_exists('asset')) {
99
    /**
100
     * Generate an asset path for the application.
101
     *
102
     * @param  string $path
103
     * @param  bool $secure
104
     * @return string
105
     */
106
    function asset($path, $secure = null)
107
    {
108
        return app('url')->asset($path, $secure);
109
    }
110
}
111
112
/**
113
 * @return \Nip\I18n\Translator
114
 */
115
function translator()
116
{
117
    return app('translator');
118
}
119
120
/**
121
 * @return Nip\Inflector\Inflector
122
 */
123
function inflector()
124
{
125 28
    return app('inflector');
126
}
127