src/Listener/AclAnnotationListener.php line 36

Open in your IDE?
  1. <?php
  2.     namespace App\Listener;
  3.     use App\Services\DTV\YamlConfig\YamlReader;
  4.     use Exception;
  5.     use ReflectionClass;
  6.     use ReflectionException;
  7.     use RuntimeException;
  8.     use Symfony\Component\HttpKernel\Event\ControllerEvent;
  9.     /**
  10.      * @deprecated
  11.      */
  12.     class AclAnnotationListener
  13.     {
  14.         private YamlReader      $yamlReader;
  15.         /**
  16.          * @throws Exception
  17.          */
  18.         public function __construct(
  19.                 YamlReader   $yamlReader
  20.         )
  21.         {
  22.             $this->yamlReader       $yamlReader;
  23.         }
  24.         /**
  25.          * @param ControllerEvent $event
  26.          *
  27.          * @return void
  28.          */
  29.         public function onKernelControllerControllerEvent $event ): void
  30.         {
  31.             if ( !$event->isMainRequest() ) {
  32.                 return;
  33.             }
  34.             $controllers $event->getController();
  35.             if ( !is_array$controllers ) ) {
  36.                 return;
  37.             }
  38.             $this->handleAnnotation$controllers );
  39.         }
  40.         /**
  41.          * @param iterable $controllers
  42.          *
  43.          * @return void
  44.          *
  45.          */
  46.         private function handleAnnotationiterable $controllers ): void
  47.         {
  48.             [ $controller$method ] = $controllers;
  49.             try {
  50.                 $controller = new ReflectionClass$controller );
  51.             }
  52.             catch ( ReflectionException $e ) {
  53.                 throw new RuntimeException'Failed to read annotation!' );
  54.             }
  55.             $this->handleMethodAnnotation$controller$method );
  56.         }
  57.         /**
  58.          * @param ReflectionClass $controller
  59.          * @param string          $method
  60.          *
  61.          * @return void
  62.          *
  63.          */
  64.         private function handleMethodAnnotationReflectionClass $controllerstring $method ): void
  65.         {
  66.             // Pour éviter les conflits entre l'ancien système et le nouveau
  67.             $community $this->yamlReader->getCommunity();
  68.         }
  69.     }