| Total Complexity | 5 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Date extends DateTime |
||
| 12 | { |
||
| 13 | /** @var Date */ |
||
| 14 | private static $today; |
||
| 15 | |||
| 16 | 9 | public function __construct(string $time = 'now', $timezone = null) |
|
| 21 | 9 | } |
|
| 22 | |||
| 23 | 1 | public function isToday(): bool |
|
| 24 | { |
||
| 25 | 1 | if (is_null(self::$today)) { |
|
| 26 | 1 | self::$today = new self('now', $this->dateTime->getTimezone()); |
|
| 27 | } |
||
| 28 | |||
| 29 | 1 | return $this->isSame(self::$today, DatePeriod::DAY); |
|
| 30 | } |
||
| 31 | |||
| 32 | 2 | protected function getDateInterval(int $value, string $period): \DateInterval |
|
| 37 | } |
||
| 38 | |||
| 39 | 7 | protected function getFormatFromTimePrecision(?string $precision): string |
|
| 44 |