Passed
Push — master ( 78cea0...e6e26f )
by Joe
02:51
created

ApiObjectCallStack::newInstance()   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 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace PhpWinTools\WmiScripting\Testing\CallStacks;
4
5
class ApiObjectCallStack
6
{
7
    protected static $instance;
8
9
    protected $stack;
10
11 1
    public function __construct()
12
    {
13 1
        static::$instance = $this;
14 1
    }
15
16 2
    public static function newInstance()
17
    {
18 2
        return static::$instance = new static();
19
    }
20
21 2
    public static function instance()
22
    {
23 2
        return static::$instance ?? new static();
24
    }
25 2
26
    public function add(ApiObjectCall $call)
27
    {
28
        $this->stack[] = $call;
29
30
        return $this;
31
    }
32
}
33