Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function __invoke( |
||
21 | ContainerInterface $container, |
||
22 | string $requestedName, |
||
23 | array $options = null |
||
24 | ): DateTimeFactory { |
||
25 | $options = $options ?? $this->getServiceOptions($container, $requestedName); |
||
26 | |||
27 | try { |
||
28 | return new DateTimeFactory( |
||
29 | $options['date_time_zone_factory'] ?? null, |
||
30 | $options['date_time_class_name'] ?? null |
||
31 | ); |
||
32 | } catch (DateTimeFactoryException $e) { |
||
33 | throw new ServiceNotCreatedException( |
||
34 | sprintf('Failed to create date time factory: %s', $e->getMessage()), |
||
35 | $e->getCode(), |
||
36 | $e |
||
37 | ); |
||
41 |