NullProgress::shouldNotifyChange()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
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
        // Empty because this is a Null pattern implementation
33
    }
34
35
    public function update(
36
        string $message = '',
37
        ?int $value = null,
38
        ?int $total = null,
39
        ?int $startTime = null,
40
        ?int $current = null
41
    ): void {
42
        // Empty because this is a Null pattern implementation
43
    }
44
45
    public function shouldNotifyChange(Status $current, Status $newStatus): bool
46
    {
47
        return false;
48
    }
49
50
    public function attach(SplObserver $observer): void
51
    {
52
        // Empty because this is a Null pattern implementation
53
    }
54
55
    public function detach(SplObserver $observer): void
56
    {
57
        // Empty because this is a Null pattern implementation
58
    }
59
60
    public function notify(): void
61
    {
62
        // Empty because this is a Null pattern implementation
63
    }
64
}
65