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

UniqueIdFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
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