Firmware   A
last analyzed

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 __construct() 0 4 1
A getBuild() 0 3 1
A getVersion() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace DaveRandom\LibLifxLan\DataTypes;
4
5
use DaveRandom\LibLifxLan\Exceptions\InvalidValueException;
6
use function DaveRandom\LibLifxLan\datetimeinterface_to_datetimeimmutable;
7
use function DaveRandom\LibLifxLan\validate_uint32;
8
9
abstract class Firmware
10
{
11
    private $build;
12
    private $version;
13
14
    /**
15
     * @param \DateTimeInterface $build
16
     * @param int $version
17
     * @throws InvalidValueException
18
     */
19 22
    protected function __construct(\DateTimeInterface $build, int $version)
20
    {
21 22
        $this->build = datetimeinterface_to_datetimeimmutable($build);
22 22
        $this->version = validate_uint32('Firmware version', $version);
23
    }
24
25 7
    public function getBuild(): \DateTimeImmutable
26
    {
27 7
        return $this->build;
28
    }
29
30 7
    public function getVersion(): int
31
    {
32 7
        return $this->version;
33
    }
34
}
35