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.

SplServiceRegistry::getInstance()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 17
rs 9.9
c 0
b 0
f 0
cc 4
nc 4
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\Containers\DataStructures;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Spl\Info\SplClassInfo;
19
20
/**
21
 * Class SplServiceRegistry
22
 *
23
 * @package O2System\Spl\Containers\DataStructures
24
 */
25
class SplServiceRegistry extends SplClassInfo
26
{
27
    /**
28
     * Service Singleton Instance
29
     *
30
     * @var object
31
     */
32
    private $instance;
33
34
    public function __construct($service)
35
    {
36
        if (is_object($service)) {
37
            $this->instance = $service;
38
            $service = get_class($service);
39
        }
40
41
        parent::__construct($service);
42
    }
43
44
    public function getClassName()
45
    {
46
        return get_class_name($this->name);
0 ignored issues
show
Bug introduced by
The function get_class_name 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

46
        return /** @scrutinizer ignore-call */ get_class_name($this->name);
Loading history...
47
    }
48
49
    public function &getInstance()
50
    {
51
        if (empty($this->instance)) {
52
            if (null !== ($constructor = $this->getConstructor())) {
53
                $args = func_get_args();
54
55
                if (count($args)) {
56
                    $this->instance = $this->newInstance();
57
                } else {
58
                    $this->instance = $this->newInstanceArgs(func_get_args());
59
                }
60
            } else {
61
                $this->instance = $this->newInstanceWithoutConstructor();
62
            }
63
        }
64
65
        return $this->instance;
66
    }
67
}