Mock::getInstance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 2
b 1
f 0
1
<?php
2
3
namespace Murtukov\PHPCodeGenerator;
4
5
/**
6
 * Helper class for conditional builders.
7
 */
8
class Mock
9
{
10
    private static object $caller;
11
    private static self   $instance;
12
13 1
    public static function getInstance(object $caller): self
14
    {
15 1
        self::$caller = $caller;
16
17 1
        return self::$instance ?? self::$instance = new self();
18
    }
19
20 1
    public function __call($name, $arguments)
21
    {
22 1
        return self::$caller;
23
    }
24
}
25