AbstractObservation   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
eloc 10
dl 0
loc 40
c 0
b 0
f 0
ccs 0
cts 15
cp 0
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A isWarning() 0 3 1
A isInfo() 0 3 1
A isKudos() 0 3 1
A getMessage() 0 3 1
A __toString() 0 3 1
A isError() 0 3 1
A __construct() 0 3 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * @license  http://opensource.org/licenses/mit-license.php MIT
5
 * @link     https://github.com/nicoSWD
6
 * @author   Nicolas Oelgart <[email protected]>
7
 */
8
namespace nicoSWD\SecHeaderCheck\Domain\Result;
9
10
abstract class AbstractObservation
11
{
12
    private $context = [];
13
    protected $message = '';
14
15
    abstract public function getPenalty(): float;
16
17
    public function __construct(?string ...$context)
18
    {
19
        $this->context = $context;
20
    }
21
22
    public function getMessage(): string
23
    {
24
        return vsprintf($this->message, $this->context);
25
    }
26
27
    public function __toString(): string
28
    {
29
        return $this->getMessage();
30
    }
31
32
    public function isError(): bool
33
    {
34
        return false;
35
    }
36
37
    public function isWarning(): bool
38
    {
39
        return false;
40
    }
41
42
    public function isInfo(): bool
43
    {
44
        return false;
45
    }
46
47
    public function isKudos(): bool
48
    {
49
        return false;
50
    }
51
}
52