Passed
Push — master ( 8634b9...ba407f )
by Chris
14:07
created

TimeInfo::getUptime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
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
    public function __construct(\DateTimeInterface $time, int $uptime, int $downtime)
14
    {
15
        $this->time = datetimeinterface_to_datetimeimmutable($time);
16
        $this->uptime = $uptime;
17
        $this->downtime = $downtime;
18
    }
19
20
    public function getTime(): \DateTimeImmutable
21
    {
22
        return $this->time;
23
    }
24
25
    public function getUptime(): int
26
    {
27
        return $this->uptime;
28
    }
29
30
    public function getDowntime(): int
31
    {
32
        return $this->downtime;
33
    }
34
}
35