Completed
Push — master ( 0d7a8a...2e892a )
by Chris
03:11
created

State::setPower()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 3
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 3
rs 9.4285
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace DaveRandom\LibLifxLan\DataTypes\Light;
4
5
use DaveRandom\LibLifxLan\DataTypes\Label;
6
use DaveRandom\LibLifxLan\Exceptions\InvalidValueException;
7
use function DaveRandom\LibLifxLan\validate_uint16;
8
9
final class State
10
{
11
    private $color;
12
    private $power;
13
    private $label;
14
15
    /**
16
     * @param HsbkColor $color
17
     * @param int $power
18
     * @param Label $label
19
     * @throws InvalidValueException
20
     */
21 8
    public function __construct(HsbkColor $color, int $power, Label $label)
22
    {
23 8
        $this->color = $color;
24 8
        $this->power = validate_uint16('Power level', $power);
25 6
        $this->label = $label;
26
    }
27
28 1
    public function getColor(): HsbkColor
29
    {
30 1
        return $this->color;
31
    }
32
33 1
    public function getPower(): int
34
    {
35 1
        return $this->power;
36
    }
37
38 1
    public function getLabel(): Label
39
    {
40 1
        return $this->label;
41
    }
42
}
43