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

ProtocolHeader::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace DaveRandom\LibLifxLan\Header;
4
5
use DaveRandom\LibLifxLan\Exceptions\InvalidValueException;
6
use function DaveRandom\LibLifxLan\validate_uint16;
7
8
final class ProtocolHeader
9
{
10
    public const WIRE_SIZE = 12;
11
12
    private $type;
13
14
    /**
15
     * @param int $type
16
     * @throws InvalidValueException
17
     */
18 29
    public function __construct(int $type)
19
    {
20 29
        $this->type = validate_uint16('Message type', $type);
21
    }
22
23 13
    public function getType(): int
24
    {
25 13
        return $this->type;
26
    }
27
}
28