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

ApiObjectCallStack   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 26
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A newInstance() 0 3 1
A instance() 0 3 1
A add() 0 5 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