TimeInfo::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
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
    /**
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