Passed
Push — master ( 8b04a3...17b456 )
by Carlos C
48s queued 11s
created

ReportUuidCommand   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 53
ccs 20
cts 20
cp 1
rs 10
wmc 8

7 Methods

Rating   Name   Duplication   Size   Complexity  
A sinceString() 0 3 1
A rfc() 0 3 1
A type() 0 3 1
A __construct() 0 9 2
A since() 0 3 1
A untilString() 0 3 1
A until() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\Finkok\Services\Utilities;
6
7
use DateTimeImmutable;
8
use LogicException;
9
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
56
    {
57 2
        return $this->since->format('Y-m-d\TH:i:s');
58
    }
59
60 2
    public function untilString(): string
61
    {
62 2
        return $this->until->format('Y-m-d\TH:i:s');
63
    }
64
}
65