| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function __invoke(ContainerInterface $container): ApiTokenLoginHandler |
||
| 16 | { |
||
| 17 | $userProvider = $container->get(\App\Security\UserProviderInterface::class); |
||
| 18 | $tokenService = $container->get(TokenManager::class); |
||
| 19 | $productAccess = $container->get(ContredanseProductAccess::class); |
||
| 20 | $accessLogger = $container->get(AccessLogger::class); |
||
| 21 | |||
| 22 | $config = $container->get('config')['contredanse'] ?? null; |
||
| 23 | if ($config === null) { |
||
| 24 | throw new ConfigException("['contredanse'] config key is missing."); |
||
| 25 | } |
||
| 26 | if (!is_array($config['auth'] ?? false)) { |
||
| 27 | throw new ConfigException("['contredanse']['auth'] config key is missing."); |
||
| 28 | } |
||
| 29 | |||
| 30 | return new ApiTokenLoginHandler($userProvider, $tokenService, $productAccess, $config['auth'], $accessLogger); |
||
| 31 | } |
||
| 33 |