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

State   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getPower() 0 3 1
A __construct() 0 5 1
A getColor() 0 3 1
A getLabel() 0 3 1
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