Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
90.00% |
9 / 10 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
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 | public static function getFormatedDates( |
8 | $timestamp, |
9 | $pattern = 'MMMM', |
10 | $locale = 'de_DE', |
11 | $timezone = 'Europe/Berlin' |
12 | ) { |
13 | $dateFormatter = new \IntlDateFormatter( |
14 | $locale, |
15 | \IntlDateFormatter::MEDIUM, |
16 | \IntlDateFormatter::MEDIUM, |
17 | $timezone, |
18 | \IntlDateFormatter::GREGORIAN, |
19 | $pattern |
20 | ); |
21 | return $dateFormatter->format($timestamp); |
22 | } |
23 | |
24 | public function __toString() |
25 | { |
26 | return $this->format('c'); |
27 | } |
28 | } |