State   A
last analyzed

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 10
    public function __construct(HsbkColor $color, int $power, Label $label)
22
    {
23 10
        $this->color = $color;
24 10
        $this->power = validate_uint16('Power level', $power);
25 8
        $this->label = $label;
26
    }
27
28 3
    public function getColor(): HsbkColor
29
    {
30 3
        return $this->color;
31
    }
32
33 3
    public function getPower(): int
34
    {
35 3
        return $this->power;
36
    }
37
38 3
    public function getLabel(): Label
39
    {
40 3
        return $this->label;
41
    }
42
}
43