Total Complexity | 8 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class ReportUuidCommand |
||
11 | { |
||
12 | /** @var string */ |
||
13 | private $rfc; |
||
14 | |||
15 | /** @var string */ |
||
16 | private $type; |
||
17 | |||
18 | /** @var DateTimeImmutable */ |
||
19 | private $since; |
||
20 | |||
21 | /** @var DateTimeImmutable */ |
||
22 | private $until; |
||
23 | |||
24 | 3 | public function __construct(string $rfc, string $type, DateTimeImmutable $since, DateTimeImmutable $until) |
|
25 | { |
||
26 | 3 | if ($since > $until) { |
|
27 | 1 | throw new LogicException('Since date is greater than until date'); |
|
28 | } |
||
29 | 2 | $this->rfc = $rfc; |
|
30 | 2 | $this->type = $type; |
|
31 | 2 | $this->since = $since; |
|
32 | 2 | $this->until = $until; |
|
33 | 2 | } |
|
34 | |||
35 | 2 | public function rfc(): string |
|
36 | { |
||
37 | 2 | return $this->rfc; |
|
38 | } |
||
39 | |||
40 | 2 | public function type(): string |
|
41 | { |
||
42 | 2 | return $this->type; |
|
43 | } |
||
44 | |||
45 | 1 | public function since(): DateTimeImmutable |
|
46 | { |
||
47 | 1 | return $this->since; |
|
48 | } |
||
49 | |||
50 | 1 | public function until(): DateTimeImmutable |
|
51 | { |
||
52 | 1 | return $this->until; |
|
53 | } |
||
54 | |||
55 | 2 | public function sinceString(): string |
|
58 | } |
||
59 | |||
60 | 2 | public function untilString(): string |
|
61 | { |
||
62 | 2 | return $this->until->format('Y-m-d\TH:i:s'); |
|
63 | } |
||
64 | } |
||
65 |