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.
Test Failed
Pull Request — master (#63)
by Yong
04:56
created

value()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

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
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
        $value = getenv($key);
14
15
        if ($value === false) {
16
            return value($default);
17
        }
18
19
        switch (strtolower($value)) {
20
            case 'true':
21
            case '(true)':
22
                return true;
23
            case 'false':
24
            case '(false)':
25
                return false;
26
            case 'empty':
27
            case '(empty)':
28
                return '';
29
            case 'null':
30
            case '(null)':
31
                return;
32
        }
33
34
        if (($valueLength = strlen($value)) > 1 && $value[0] === '"' && $value[$valueLength - 1] === '"') {
35
            return substr($value, 1, -1);
36
        }
37
38
        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
        return $value instanceof Closure ? $value() : $value;
53
    }
54
}
55