ReflectionSingleton   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 13
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 8 2
1
<?php
2
3
namespace Pgs\ElasticOM;
4
5
class ReflectionSingleton
6
{
7
    private static $instances = [];
8
9 2
    public static function getInstance(string $name): \ReflectionClass
10
    {
11 2
        if (!isset(self::$instances[$name])) {
12 2
            self::$instances[$name] = new \ReflectionClass($name);
13
        }
14
15 2
        return self::$instances[$name];
16
    }
17
}
18