Singleton   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 12
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 8 2
1
<?php
2
3
namespace mvc\core\meta;
4
5
6
abstract class Singleton
7
{
8
    private static array $_instances = [];
9
10
    public static function getInstance(): self
11
    {
12
        $class = get_called_class();
13
14
        if (!isset(self::$_instances[$class]))
15
            self::$_instances[$class] = new $class();
16
17
        return self::$_instances[$class];
18
    }
19
}
20