| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public function __invoke(ContainerInterface $container): ContredanseProductAccess |
||
| 17 | { |
||
| 18 | $config = $container->get('config')['contredanse'] ?? null; |
||
| 19 | if ($config === null) { |
||
| 20 | throw new ConfigException("['contredanse'] config key is missing."); |
||
| 21 | } |
||
| 22 | if (!is_array($config['products'] ?? false)) { |
||
| 23 | throw new ConfigException("['contredanse']['products'] config key is missing."); |
||
| 24 | } |
||
| 25 | |||
| 26 | return new ContredanseProductAccess( |
||
| 27 | $container->get(ContredanseDb::class)->getPdoAdapter(), |
||
| 28 | $config['products'] |
||
| 29 | ); |
||
| 32 |