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.
Completed
Push — master ( 4b6825...44404b )
by Jad
19:29
created

Filters::getTypeName()   B

Complexity

Conditions 6
Paths 7

Size

Total Lines 27
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
cc 6
eloc 17
c 2
b 1
f 1
nc 7
nop 2
dl 0
loc 27
rs 8.439
1
<?php
2
3
/**
4
 * This file is part of the ApiGen (http://apigen.org)
5
 *
6
 * For the full copyright and license information, please view
7
 * the file LICENSE that was distributed with this source code.
8
 */
9
10
namespace ApiGen\Templating\Filters;
11
12
abstract class Filters
13
{
14
15
    /**
16
     * Calls public method with args if exists and passes args.
17
     *
18
     * @param string $name
19
     * @throws \Exception
20
     * @return mixed
21
     */
22
    public function loader($name)
23
    {
24
        if (method_exists($this, $name)) {
25
            $args = array_slice(func_get_args(), 1);
26
            return call_user_func_array([$this, $name], $args);
27
        }
28
        return null;
29
    }
30
31
32
    /**
33
     * @param string $string
34
     * @return string
35
     */
36
    public static function urlize($string)
37
    {
38
        return preg_replace('~[^\w]~', '.', $string);
39
    }
40
41
42
    /**
43
     * @param string $name
44
     * @param bool $trimNamespaceSeparator
45
     * @return string
46
     */
47
    protected function getTypeName($name, $trimNamespaceSeparator = true)
48
    {
49
        $names = [
50
            'int' => 'integer',
51
            'bool' => 'boolean',
52
            'double' => 'float',
53
            'void' => '',
54
            'FALSE' => 'false',
55
            'TRUE' => 'true',
56
            'NULL' => 'null',
57
            'callback' => 'callable'
58
        ];
59
60
        // Simple type
61
        if (strlen($name) > 2 && substr($name, -2) === '[]') {
62
            $clearName = substr($name, 0, -2);
63
            if (isset($names[$clearName])) {
64
                return $names[$clearName] . '[]';
65
            }
66
        }
67
        if (isset($names[$name])) {
68
            return $names[$name];
69
        }
70
71
        // Class, constant or function
72
        return $trimNamespaceSeparator ? ltrim($name, '\\') : $name;
73
    }
74
75
76
    /**
77
     * @param string $url
78
     * @return string
79
     */
80
    private function url($url)
81
    {
82
        return rawurlencode($url);
83
    }
84
}
85