Passed
Branch win32modeltests (0c705a)
by Joe
02:47
created

ApiObjectCallStack   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 26
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
    public function __construct()
12
    {
13
        static::$instance = $this;
14
    }
15
16
    public static function newInstance()
17
    {
18
        return static::$instance = new static();
19
    }
20
21
    public static function instance()
22
    {
23
        return static::$instance ?? new static();
24
    }
25
26
    public function add(ApiObjectCall $call)
27
    {
28
        $this->stack[] = $call;
29
30
        return $this;
31
    }
32
}
33