src/Kernel.php line 46

Open in your IDE?
  1. <?php
  2. namespace App;
  3. use App\Security\Factory\OtpAuthFactory;
  4. use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
  5. use Symfony\Component\DependencyInjection\ContainerBuilder;
  6. use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
  7. use Symfony\Component\HttpKernel\Kernel as BaseKernel;
  8. use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
  9. class Kernel extends BaseKernel
  10. {
  11.     use MicroKernelTrait;
  12.     protected function configureContainer(ContainerConfigurator $container): void
  13.     {
  14.         $container->import('../config/{packages}/*.yaml');
  15.         $container->import('../config/{packages}/'.$this->environment.'/*.yaml');
  16.         if (is_file(\dirname(__DIR__).'/config/services.yaml')) {
  17.             $container->import('../config/{services}.yaml');
  18.             $container->import('../config/{services}_'.$this->environment.'.yaml');
  19.         } elseif (is_file($path \dirname(__DIR__).'/config/services.php')) {
  20.             (require $path)($container->withPath($path), $this);
  21.         }
  22.     }
  23.     protected function configureRoutes(RoutingConfigurator $routes): void
  24.     {
  25.         $routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
  26.         $routes->import('../config/{routes}/*.yaml');
  27.         if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
  28.             $routes->import('../config/{routes}.yaml');
  29.         } elseif (is_file($path \dirname(__DIR__).'/config/routes.php')) {
  30.             (require $path)($routes->withPath($path), $this);
  31.         }
  32.     }
  33.     protected function build(ContainerBuilder $container)
  34.     {
  35.         parent::build($container);
  36.         $extension $container->getExtension('security');
  37.         $extension->addSecurityListenerFactory(new OtpAuthFactory());
  38.     }
  39. }