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

ApiObjectCallStack::newInstance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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