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

FrameAddress::isResponseRequired()   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 0
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 DaveRandom\Network\MacAddress;
7
use function DaveRandom\LibLifxLan\validate_uint8;
8
9
final class FrameAddress
10
{
11
    public const WIRE_SIZE = 16;
12
13
    private $target;
14
    private $ackRequired;
15
    private $responseRequired;
16
    private $sequenceNo;
17
18
    /**
19
     * @param MacAddress $target
20
     * @param bool $ackRequired
21
     * @param bool $responseRequired
22
     * @param int $sequenceNo
23
     * @throws InvalidValueException
24
     */
25 38
    public function __construct(MacAddress $target, bool $ackRequired, bool $responseRequired, int $sequenceNo)
26
    {
27 38
        $this->target = $target;
28 38
        $this->ackRequired = $ackRequired;
29 38
        $this->responseRequired = $responseRequired;
30 38
        $this->sequenceNo = validate_uint8('Sequence number', $sequenceNo);
31
    }
32
33 20
    public function getTarget(): MacAddress
34
    {
35 20
        return $this->target;
36
    }
37
38 19
    public function isAckRequired(): bool
39
    {
40 19
        return $this->ackRequired;
41
    }
42
43 19
    public function isResponseRequired(): bool
44
    {
45 19
        return $this->responseRequired;
46
    }
47
48 19
    public function getSequenceNo(): int
49
    {
50 19
        return $this->sequenceNo;
51
    }
52
}
53