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 ( c1b524...f9fd4d )
by Robert
12:38
created

StaticInstanceTrait::instance()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 2
nop 1
crap 3
1
<?php
2
/**
3
 * @link http://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license http://www.yiiframework.com/license/
6
 */
7
8
namespace yii\base;
9
10
use Yii;
11
12
/**
13
 * StaticInstanceTrait provides methods to satisfy [[StaticInstanceInterface]] interface.
14
 *
15
 * @see StaticInstanceInterface
16
 *
17
 * @author Paul Klimov <[email protected]>
18
 * @since 2.0.13
19
 */
20
trait StaticInstanceTrait
21
{
22
    /**
23
     * @var static[] static instances in format: `[className => object]`
24
     */
25
    private static $_instances = [];
26
27
28
    /**
29
     * Returns static class instance, which can be used to obtain meta information.
30
     * @param bool $refresh whether to re-create static instance even, if it is already cached.
31
     * @return static class instance.
32
     */
33 67
    public static function instance($refresh = false)
34
    {
35 67
        $className = get_called_class();
36 67
        if ($refresh || !isset(self::$_instances[$className])) {
37 5
            self::$_instances[$className] = Yii::createObject($className);
38
        }
39 67
        return self::$_instances[$className];
40
    }
41
}