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.

SplClassInfo::getParameter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Spl\Info;
15
16
// ------------------------------------------------------------------------
17
18
/**
19
 * Class SplClassInfo
20
 *
21
 * @package O2System\Spl\Info
22
 */
23
class SplClassInfo extends \ReflectionClass
24
{
25
    /**
26
     * Class Name
27
     *
28
     * @var string
29
     */
30
    public $name;
31
32
    // ------------------------------------------------------------------------
33
34
    /**
35
     * SplClassInfo constructor.
36
     *
37
     * @param mixed $className
38
     */
39
    public function __construct($className)
40
    {
41
        if (is_object($className)) {
42
            $className = get_class($className);
43
        }
44
45
        if (class_exists($className)) {
46
            parent::__construct($className);
47
        }
48
    }
49
50
    // ------------------------------------------------------------------------
51
52
    /**
53
     * SplClassInfo::getClass
54
     *
55
     * Gets class name.
56
     *
57
     * @return string
58
     */
59
    public function getClass()
60
    {
61
        return $this->name;
62
    }
63
64
    // ------------------------------------------------------------------------
65
66
    /**
67
     * SplClassInfo::getParameter
68
     *
69
     * Gets class name.
70
     *
71
     * @return string
72
     */
73
    public function getParameter()
74
    {
75
        $parts = explode('\\', $this->name);
76
77
        return dash(end($parts));
0 ignored issues
show
Bug introduced by
The function dash was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

77
        return /** @scrutinizer ignore-call */ dash(end($parts));
Loading history...
78
    }
79
80
    // ------------------------------------------------------------------------
81
82
    /**
83
     * SplClassInfo::getFileInfo
84
     *
85
     * Gets class file info metadata.
86
     *
87
     * @return \O2System\Spl\Info\SplNamespaceInfo
88
     */
89
    public function getNamespaceInfo()
90
    {
91
        if (empty($this->name)) {
92
            throw new \RuntimeException('Internal error: SplClassInfo failed to retrieve the reflection object');
93
        }
94
95
        return new SplNamespaceInfo($this->name, $this->getFileName());
96
    }
97
98
    // ------------------------------------------------------------------------
99
100
    /**
101
     * SplClassInfo::getFileInfo
102
     *
103
     * Gets class file info metadata.
104
     *
105
     * @return \O2System\Spl\Info\SplFileInfo
106
     */
107
    public function getFileInfo()
108
    {
109
        if (empty($this->name)) {
110
            throw new \RuntimeException('Internal error: SplClassInfo failed to retrieve the reflection object');
111
        }
112
113
        return new SplFileInfo($this->getFileName());
114
    }
115
}