| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public function __invoke(ContainerInterface $container): AuthTokenMiddleware |
||
| 17 | { |
||
| 18 | $config = $container->get('config')['token_manager'] ?? null; |
||
| 19 | if ($config === null) { |
||
| 20 | throw new ConfigException("['token_manager'] config key is missing."); |
||
| 21 | } |
||
| 22 | |||
| 23 | $options = [ |
||
| 24 | AuthTokenMiddleware::OPTION_ALLOW_INSECURE_HTTP => $config['allow_insecure_http'], |
||
| 25 | AuthTokenMiddleware::OPTION_RELAXED_HOSTS => $config['relaxed_hosts'] |
||
| 26 | ]; |
||
| 27 | |||
| 28 | return new AuthTokenMiddleware( |
||
| 29 | $container->get(TokenManager::class), |
||
| 30 | $options |
||
| 31 | ); |
||
| 34 |