Lines 90.00% 9 / 10
Methods 50.00% 1 / 2
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 getFormatedDates 100.00% 9 / 9 100.00% 1 / 1 1
 __toString 0.00% 0 / 1 0.00% 0 / 1 2
5class 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}