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

PowerTransition   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDuration() 0 3 1
A getLevel() 0 3 1
A __construct() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace DaveRandom\LibLifxLan\DataTypes\Light;
4
5
use DaveRandom\LibLifxLan\Exceptions\InvalidValueException;
6
use function DaveRandom\LibLifxLan\validate_uint16;
7
use function DaveRandom\LibLifxLan\validate_uint32;
8
9
final class PowerTransition
10
{
11
    private $level;
12
    private $duration;
13
14
    /**
15
     * @param int $level
16
     * @param int $duration
17
     * @throws InvalidValueException
18
     */
19 9
    public function __construct(int $level, int $duration)
20
    {
21 9
        $this->level = validate_uint16('Power level', $level);
22 7
        $this->duration = validate_uint32('Transition duration', $duration);
23
    }
24
25 1
    public function getLevel(): int
26
    {
27 1
        return $this->level;
28
    }
29
30 1
    public function getDuration(): int
31
    {
32 1
        return $this->duration;
33
    }
34
}
35