NullProgress   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 46
rs 10
c 0
b 0
f 0
wmc 9

8 Methods

Rating   Name   Duplication   Size   Complexity  
A notify() 0 2 1
A shouldNotifyChange() 0 3 1
A detach() 0 2 1
A attach() 0 2 1
A __construct() 0 3 2
A update() 0 7 1
A getStatus() 0 3 1
A increase() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EngineWorks\ProgressStatus;
6
7
use SplObserver;
8
9
/**
10
 * NullProgress is a null object implementation of ProgressInterface.
11
 *
12
 * @infection-ignore-all
13
 * @codeCoverageIgnore Null implementation
14
 */
15
class NullProgress implements ProgressInterface
16
{
17
    /** @var Status */
18
    private $status;
19
20
    public function __construct(Status $status = null)
21
    {
22
        $this->status = $status ?: Status::make();
23
    }
24
25
    public function getStatus(): Status
26
    {
27
        return $this->status;
28
    }
29
30
    public function increase(string $message = '', $increase = 1): void
31
    {
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public function update(
38
        string $message = null,
39
        $value = null,
40
        $total = null,
41
        int $startTime = null,
42
        int $current = null
43
    ): void {
44
    }
45
46
    public function shouldNotifyChange(Status $current, Status $newStatus): bool
47
    {
48
        return false;
49
    }
50
51
    public function attach(SplObserver $observer): void
52
    {
53
    }
54
55
    public function detach(SplObserver $observer): void
56
    {
57
    }
58
59
    public function notify(): void
60
    {
61
    }
62
}
63