Total Complexity | 5 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class TimeIntervalDto |
||
10 | { |
||
11 | private $duration; |
||
12 | private $end; |
||
13 | private $start; |
||
14 | |||
15 | public static function fromArray(array $data): self |
||
16 | { |
||
17 | return new self( |
||
18 | new DateTimeImmutable($data['start']), |
||
19 | new DateTimeImmutable($data['end']), |
||
20 | $data['duration'] |
||
21 | ); |
||
22 | } |
||
23 | |||
24 | public function __construct( |
||
25 | DateTimeImmutable $start, |
||
26 | DateTimeImmutable $end, |
||
27 | string $duration |
||
28 | ) { |
||
29 | $this->duration = $duration; |
||
30 | $this->start = $start; |
||
31 | $this->end = $end; |
||
32 | } |
||
33 | |||
34 | public function duration(): string |
||
37 | } |
||
38 | |||
39 | public function end(): DateTimeImmutable |
||
42 | } |
||
43 | |||
44 | public function start(): DateTimeImmutable |
||
49 |