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.
Passed
Push — master ( 965312...9a1478 )
by
unknown
05:58
created

value()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 2
rs 10
1
<?php
2
if (!function_exists('env')) {
3
    /**
4
     * Gets the value of an environment variable.
5
     *
6
     * @param  string $key
7
     * @param  mixed  $default
8
     *
9
     * @return mixed
10
     */
11
    function env($key, $default = null)
12
    {
13 163
        $value = getenv($key);
14
15 163
        if ($value === false) {
16 36
            return value($default);
17
        }
18
19 127
        switch (strtolower($value)) {
20 127
            case 'true':
21 127
            case '(true)':
22 1
                return true;
23 127
            case 'false':
24 127
            case '(false)':
25 125
                return false;
26 3
            case 'empty':
27 3
            case '(empty)':
28 1
                return '';
29 3
            case 'null':
30 3
            case '(null)':
31 1
                return null;
32 2
        }
33
34 2
        if (($valueLength = strlen($value)) > 1 && $value[0] === '"' && $value[$valueLength - 1] === '"') {
35 1
            return substr($value, 1, -1);
36
        }
37
38 2
        return $value;
39
    }
40
}
41
42
if (!function_exists('value')) {
43
    /**
44
     * Return the default value of the given value.
45
     *
46
     * @param  mixed $value
47
     *
48
     * @return mixed
49
     */
50
    function value($value)
51
    {
52 36
        return $value instanceof Closure ? $value() : $value;
53
    }
54
}
55