| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 21 | public function __invoke( |
||
| 22 | ContainerInterface $container, |
||
| 23 | string $requestedName, |
||
| 24 | array $options = null |
||
| 25 | ): DateTimeFormatterStrategy { |
||
| 26 | $options = $options ?? $this->getServiceOptions($container, $requestedName); |
||
| 27 | |||
| 28 | $format = $options['format'] ?? null; |
||
| 29 | if (null === $format) { |
||
| 30 | throw new ServiceNotCreatedException( |
||
| 31 | sprintf( |
||
| 32 | 'The required \'format\' configuration option is missing for service \'%s\'', |
||
| 33 | $requestedName |
||
| 34 | ) |
||
| 35 | ); |
||
| 36 | } |
||
| 37 | |||
| 38 | return new DateTimeFormatterStrategy($format, $options['timezone'] ?? null, $options['fallback'] ?? false); |
||
| 39 | } |
||
| 41 |