Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
Time
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 __toString
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 localize
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 parse
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Cosray\Value;
6
7use DateTimeImmutable;
8use IntlDateFormatter;
9use Override;
10
11class Time extends DateTime
12{
13    public const FORMAT = 'H:i';
14
15    #[Override]
16    public function __toString(): string
17    {
18        return $this->format(static::FORMAT);
19    }
20
21    #[Override]
22    public function localize(
23        int $dateFormat = IntlDateFormatter::NONE,
24        int $timeFormat = IntlDateFormatter::SHORT,
25    ): string {
26        return parent::localize($dateFormat, $timeFormat);
27    }
28
29    #[Override]
30    protected function parse(string $value): ?DateTimeImmutable
31    {
32        return $this->parseFormat($value, static::FORMAT);
33    }
34}