1 | <?php |
||
9 | class Time |
||
10 | { |
||
11 | /** @var int */ |
||
12 | protected $hours; |
||
13 | |||
14 | /** @var int */ |
||
15 | protected $minutes; |
||
16 | |||
17 | 53 | protected function __construct(int $hours, int $minutes) |
|
22 | |||
23 | 54 | public static function fromString(string $string): self |
|
33 | |||
34 | 15 | public static function fromDateTime(DateTimeInterface $dateTime): self |
|
38 | |||
39 | 33 | public function isSame(Time $time): bool |
|
43 | |||
44 | 32 | public function isAfter(Time $time): bool |
|
56 | |||
57 | 30 | public function isBefore(Time $time): bool |
|
65 | |||
66 | 29 | public function isSameOrAfter(Time $time): bool |
|
70 | |||
71 | 44 | public function toDateTime(): DateTime |
|
75 | |||
76 | 44 | public function format(string $format = 'H:i'): string |
|
80 | |||
81 | 37 | public function __toString(): string |
|
85 | } |
||
86 |