Total Complexity | 6 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
12 | final class State |
||
13 | { |
||
14 | // Migration status |
||
15 | public const STATUS_UNDEFINED = -1; |
||
16 | public const STATUS_PENDING = 0; |
||
17 | public const STATUS_EXECUTED = 1; |
||
18 | |||
19 | 328 | public function __construct( |
|
20 | private string $name, |
||
21 | private DateTimeInterface $timeCreated, |
||
22 | private int $status = self::STATUS_UNDEFINED, |
||
23 | private ?DateTimeInterface $timeExecuted = null |
||
24 | ) { |
||
25 | } |
||
26 | |||
27 | 304 | public function getName(): string |
|
28 | { |
||
29 | 304 | return $this->name; |
|
30 | } |
||
31 | |||
32 | 296 | public function getStatus(): int |
|
33 | { |
||
34 | 296 | return $this->status; |
|
35 | } |
||
36 | |||
37 | 304 | public function getTimeCreated(): DateTimeInterface |
|
38 | { |
||
39 | 304 | return $this->timeCreated; |
|
40 | } |
||
41 | |||
42 | 8 | public function getTimeExecuted(): ?DateTimeInterface |
|
43 | { |
||
44 | 8 | return $this->timeExecuted; |
|
45 | } |
||
46 | |||
47 | 296 | public function withStatus(int $status, DateTimeInterface $timeExecuted = null): self |
|
54 | } |
||
55 | } |
||
56 |