| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function __invoke(ContainerInterface $container, string $requestedName, array $options = null): FixedClock |
||
| 22 | { |
||
| 23 | $options = $options ?? $this->getServiceOptions($container, $requestedName, 'laminas_date_time'); |
||
| 24 | |||
| 25 | if (empty($options['date_time_immutable'])) { |
||
| 26 | throw new ServiceNotCreatedException( |
||
| 27 | sprintf( |
||
| 28 | 'The required \'date_time_immutable\' configuration option is missing for service \'%s\'', |
||
| 29 | $requestedName |
||
| 30 | ), |
||
| 31 | ); |
||
| 32 | } |
||
| 33 | |||
| 34 | if (is_string($options['date_time_immutable'])) { |
||
| 35 | /** @var DateTimeImmutableFactory $dateTimeImmutableFactory */ |
||
| 36 | $dateTimeImmutableFactory = $this->getService($container, DateTimeImmutableFactory::class, $requestedName); |
||
| 37 | $options['date_time_immutable'] = $dateTimeImmutableFactory->createDateTime( |
||
| 38 | $options['date_time_immutable'], |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 42 | return new FixedClock($options['date_time_immutable']); |
||
| 43 | } |
||
| 45 |