| Total Complexity | 4 | 
| Total Lines | 46 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 13 | final class DateTimeZoneFactory implements DateTimeZoneFactoryInterface  | 
            ||
| 14 | { | 
            ||
| 15 | /**  | 
            ||
| 16 | * @var string  | 
            ||
| 17 | */  | 
            ||
| 18 | private string $dateTimeZoneClassName;  | 
            ||
| 19 | |||
| 20 | /**  | 
            ||
| 21 | * @param string|null $dateTimeZoneClassName  | 
            ||
| 22 | *  | 
            ||
| 23 | * @throws DateTimeZoneFactoryException  | 
            ||
| 24 | */  | 
            ||
| 25 | public function __construct(string $dateTimeZoneClassName = null)  | 
            ||
| 26 |     { | 
            ||
| 27 | $dateTimeZoneClassName ??= \DateTimeZone::class;  | 
            ||
| 28 |         if (!is_a($dateTimeZoneClassName, \DateTimeZone::class, true)) { | 
            ||
| 29 | throw new DateTimeZoneFactoryException(  | 
            ||
| 30 | sprintf(  | 
            ||
| 31 | 'The \'dateTimeZoneClassName\' parameter must be a class name that implements \'%s\'',  | 
            ||
| 32 | \DateTimeZone::class  | 
            ||
| 33 | )  | 
            ||
| 34 | );  | 
            ||
| 35 | }  | 
            ||
| 36 | $this->dateTimeZoneClassName = $dateTimeZoneClassName;  | 
            ||
| 37 | }  | 
            ||
| 38 | |||
| 39 | /**  | 
            ||
| 40 | * @param string $spec The date time zone specification  | 
            ||
| 41 | *  | 
            ||
| 42 | * @return \DateTimeZone  | 
            ||
| 43 | *  | 
            ||
| 44 | * @throws DateTimeZoneFactoryException If the \DateTimeZone cannot be created  | 
            ||
| 45 | */  | 
            ||
| 46 | public function createDateTimeZone(string $spec): \DateTimeZone  | 
            ||
| 59 | );  | 
            ||
| 60 | }  | 
            ||
| 63 |