Version::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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