| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | public function __invoke( |
||
| 20 | ContainerInterface $container, |
||
| 21 | string $requestedName, |
||
| 22 | array $options = null |
||
| 23 | ): DateTimeImmutableFactory { |
||
| 24 | $options = $options ?? $this->getServiceOptions($container, $requestedName, 'laminas_date_time'); |
||
| 25 | |||
| 26 | if (isset($options['date_time_zone_factory']) && is_string($options['date_time_zone_factory'])) { |
||
| 27 | $options['date_time_zone_factory'] = $this->getService( |
||
| 28 | $container, |
||
| 29 | $options['date_time_zone_factory'], |
||
| 30 | $requestedName |
||
| 31 | ); |
||
| 32 | } |
||
| 33 | |||
| 34 | try { |
||
| 35 | return new DateTimeImmutableFactory( |
||
| 36 | $options['class_name'] ?? null, |
||
| 37 | $options['date_time_zone_factory'] ?? null, |
||
| 38 | ); |
||
| 39 | } catch (DateTimeFactoryException $e) { |
||
| 40 | throw new ServiceNotCreatedException( |
||
| 41 | sprintf('Failed to create date time immutable factory service \'%s\'', $requestedName), |
||
| 42 | $e->getCode(), |
||
| 43 | $e, |
||
| 44 | ); |
||
| 48 |