NetworkInfo   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getRx() 0 3 1
A __construct() 0 5 1
A getSignal() 0 3 1
A getTx() 0 3 1
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
abstract class NetworkInfo
9
{
10
    private $signal;
11
    private $tx;
12
    private $rx;
13
14
    /**
15
     * @param float $signal
16
     * @param int $tx
17
     * @param int $rx
18
     * @throws InvalidValueException
19
     */
20 31
    protected function __construct(float $signal, int $tx, int $rx)
21
    {
22 31
        $this->signal = $signal;
23 31
        $this->tx = validate_uint32('Transmitted bytes', $tx);
24 25
        $this->rx = validate_uint32('Recieved bytes', $rx);
25
    }
26
27 7
    public function getSignal(): float
28
    {
29 7
        return $this->signal;
30
    }
31
32 7
    public function getTx(): int
33
    {
34 7
        return $this->tx;
35
    }
36
37 7
    public function getRx(): int
38
    {
39 7
        return $this->rx;
40
    }
41
}
42