NDeviation::valid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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