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

ProtocolHeader::setType()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 3
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 3
rs 9.4285
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A ProtocolHeader::__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 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