TimeInfo   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getDowntime() 0 3 1
A getUptime() 0 3 1
A getTime() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace DaveRandom\LibLifxLan\DataTypes;
4
5
use function DaveRandom\LibLifxLan\datetimeinterface_to_datetimeimmutable;
6
7
final class TimeInfo
8
{
9
    private $time;
10
    private $uptime;
11
    private $downtime;
12
13
    /**
14
     * @param \DateTimeInterface $time
15
     * @param int $uptime
16
     * @param int $downtime
17
     */
18 8
    public function __construct(\DateTimeInterface $time, int $uptime, int $downtime)
19
    {
20 8
        $this->time = datetimeinterface_to_datetimeimmutable($time);
21 8
        $this->uptime = $uptime;
22 8
        $this->downtime = $downtime;
23
    }
24
25 3
    public function getTime(): \DateTimeImmutable
26
    {
27 3
        return $this->time;
28
    }
29
30 3
    public function getUptime(): int
31
    {
32 3
        return $this->uptime;
33
    }
34
35 3
    public function getDowntime(): int
36
    {
37 3
        return $this->downtime;
38
    }
39
}
40