ProtocolHeader   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A __construct() 0 3 1
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 31
    public function __construct(int $type)
19
    {
20 31
        $this->type = validate_uint16('Message type', $type);
21
    }
22
23 15
    public function getType(): int
24
    {
25 15
        return $this->type;
26
    }
27
}
28