NDeviation   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 67
ccs 10
cts 15
cp 0.6667
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A __debugInfo() 0 7 1
A getType() 0 4 1
A getValue() 0 4 1
A valid() 0 4 1
A getNDeviation() 0 4 1
1
<?php
2
namespace FilmTools\NDeviation;
3
4
class NDeviation implements NDeviationInterface, NDeviationProviderInterface
5
{
6
7
    /**
8
     * @var float|null
9
     */
10
    public $ndeviation;
11
12
    /**
13
     * @var string|null
14
     */
15
    public $type;
16
17
18
    /**
19
     * @param float       $ndeviation  Zone system N deviation value
20
     * @param string|null $type        Optional: Short description
21
     */
22 15
    public function __construct( ?float $ndeviation, string $type = null)
23
    {
24 15
        $this->ndeviation = $ndeviation;
25 15
        $this->type = $type;
26 15
    }
27
28
    /**
29
     * @return  mixed[]
30
     */
31
    public function __debugInfo() : array
32
    {
33
        return [
34
            'type'  => $this->getType(),
35
            'value' => $this->getValue()
36
        ];
37
    }
38
39 12
    /**
40
     * @inheritDoc
41 12
     */
42
    public function getType() : ?string
43
    {
44
        return $this->type;
45
    }
46
47 12
    /**
48
     * @inheritDoc
49 12
     */
50
    public function getValue() : ?float
51
    {
52
        return $this->ndeviation;
53
    }
54
55
    /**
56
     * @return bool
57
     */
58
    public function valid() : bool
59
    {
60
        return !is_null( $this->ndeviation );
61
    }
62
63 3
    /**
64
     * @inheritDoc
65 3
     */
66
    public function getNDeviation() : NDeviationInterface
67
    {
68
        return $this;
69
    }
70
}
71