Lines
90.00%
9 / 10
Functions and Methods
50.00%
1 / 2
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| DateTime | 90.00% | 9 / 10 | 50.00% | 1 / 2 | 2.00 | 0.00% | 0 / 1 | |||
| getFormatedDates | 100.00% | 9 / 9 | 100.00% | 1 / 1 | 1 | |||||
| __toString | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | namespace BO\Zmsdldb\Helper; | |
| 4 | ||
| 5 | class DateTime extends \DateTimeImmutable | |
| 6 | { | |
| 7 | /** | |
| 8 | * @return false|string | |
| 9 | */ | |
| 10 | public static function getFormatedDates( | |
| 11 | \DateTimeImmutable $timestamp, | |
| 12 | string $pattern = 'MMMM', | |
| 13 | string $locale = 'de_DE', | |
| 14 | string $timezone = 'Europe/Berlin' | |
| 15 | ): string|false { | |
| 16 | $dateFormatter = new \IntlDateFormatter( | |
| 17 | $locale, | |
| 18 | \IntlDateFormatter::MEDIUM, | |
| 19 | \IntlDateFormatter::MEDIUM, | |
| 20 | $timezone, | |
| 21 | \IntlDateFormatter::GREGORIAN, | |
| 22 | $pattern | |
| 23 | ); | |
| 24 | return $dateFormatter->format($timestamp); | |
| 25 | } | |
| 26 | ||
| 27 | public function __toString() | |
| 28 | { | |
| 29 | return $this->format('c'); | |
| 30 | } | |
| 31 | } |