| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | public function __invoke( |
||
| 32 | ContainerInterface $container, |
||
| 33 | $requestedName, |
||
| 34 | array $options = null |
||
| 35 | ): DateTimeFormatterStrategy { |
||
| 36 | $options = $options ?? $this->getServiceOptions($container, $requestedName); |
||
| 37 | |||
| 38 | $format = $options['format'] ?? null; |
||
| 39 | if (null === $format) { |
||
| 40 | throw new ServiceNotCreatedException( |
||
| 41 | sprintf( |
||
| 42 | 'The required \'format\' configuration option is missing for service \'%s\'', |
||
| 43 | $requestedName |
||
| 44 | ) |
||
| 45 | ); |
||
| 46 | } |
||
| 47 | |||
| 48 | return new DateTimeFormatterStrategy($format, $options['timezone'] ?? null, $options['fallback'] ?? false); |
||
| 49 | } |
||
| 51 |