Passed
Push — master ( ccfde0...23ae65 )
by Petr
09:08
created

UniqueIdFactory   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 81.82%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 25
ccs 9
cts 11
cp 0.8182
rs 10
c 1
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFactoryInstance() 0 6 2
A __construct() 0 3 1
A __clone() 0 2 1
A getClass() 0 3 1
1
<?php
2
3
namespace kalanis\kw_mapper\Storage\Shared\QueryBuilder;
4
5
6
class UniqueIdFactory
7
{
8
    protected static ?self $instance = null;
9
    protected UniqueId $class;
10
11 145
    public static function getFactoryInstance(): self
12
    {
13 145
        if (empty(static::$instance)) {
14 1
            static::$instance = new self();
15
        }
16 145
        return static::$instance;
0 ignored issues
show
Bug Best Practice introduced by
The expression return static::instance could return the type null which is incompatible with the type-hinted return kalanis\kw_mapper\Storag...Builder\UniqueIdFactory. Consider adding an additional type-check to rule them out.
Loading history...
17
    }
18
19 1
    protected function __construct()
20
    {
21 1
        $this->class = new UniqueId();
22 1
    }
23
24
    private function __clone()
25
    {
26
    }
27
28 145
    public function getClass(): UniqueId
29
    {
30 145
        return $this->class;
31
    }
32
}
33