]> Raphaƫl G. Git Repositories - userbundle/blobdiff - Handler/AuthenticationFailureHandler.php
Remove getAlias member function
[userbundle] / Handler / AuthenticationFailureHandler.php
index 4cbd0c60b54ab7dfbd100dc482a1ac8c4e9263d2..01a4b12e5a79d8bd201f345b044327e160daba30 100644 (file)
@@ -12,7 +12,9 @@
 namespace Rapsys\UserBundle\Handler;
 
 use Doctrine\Persistence\ManagerRegistry;
 namespace Rapsys\UserBundle\Handler;
 
 use Doctrine\Persistence\ManagerRegistry;
+
 use Psr\Log\LoggerInterface;
 use Psr\Log\LoggerInterface;
+
 use Symfony\Bridge\Twig\Mime\TemplatedEmail;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 use Symfony\Bridge\Twig\Mime\TemplatedEmail;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -36,6 +38,7 @@ use Symfony\Component\Security\Http\HttpUtils;
 use Symfony\Contracts\Translation\TranslatorInterface;
 
 use Rapsys\PackBundle\Util\SluggerUtil;
 use Symfony\Contracts\Translation\TranslatorInterface;
 
 use Rapsys\PackBundle\Util\SluggerUtil;
+
 use Rapsys\UserBundle\Exception\UnactivatedException;
 use Rapsys\UserBundle\RapsysUserBundle;
 
 use Rapsys\UserBundle\Exception\UnactivatedException;
 use Rapsys\UserBundle\RapsysUserBundle;
 
@@ -47,7 +50,6 @@ class AuthenticationFailureHandler extends DefaultAuthenticationFailureHandler {
         * Config array
         */
        protected array $config;
         * Config array
         */
        protected array $config;
-       protected array $options;
        protected array $defaultOptions = [
                'failure_path' => null,
                'failure_forward' => false,
        protected array $defaultOptions = [
                'failure_path' => null,
                'failure_forward' => false,
@@ -56,36 +58,8 @@ class AuthenticationFailureHandler extends DefaultAuthenticationFailureHandler {
        ];
 
        /**
        ];
 
        /**
-        * Doctrine instance
-        */
-       protected ManagerRegistry $doctrine;
-
-       /**
-        * MailerInterface
-        */
-       protected MailerInterface $mailer;
-
-       /**
-        * Router instance
-        */
-       protected RouterInterface $router;
-
-       /**
-        * Slugger instance
-        */
-       protected SluggerUtil $slugger;
-
-       /**
-        * RequestStack instance
-        */
-       protected RequestStack $stack;
-
-       /**
-        * Translator instance
-        */
-       protected TranslatorInterface $translator;
-
-       /**
+        * {@inheritdoc}
+        *
         * @xxx Second argument will be replaced by security.firewalls.main.logout.target
         * @see vendor/symfony/security-bundle/DependencyInjection/SecurityExtension.php +360
         *
         * @xxx Second argument will be replaced by security.firewalls.main.logout.target
         * @see vendor/symfony/security-bundle/DependencyInjection/SecurityExtension.php +360
         *
@@ -100,33 +74,13 @@ class AuthenticationFailureHandler extends DefaultAuthenticationFailureHandler {
         * @param SluggerUtil $slugger The slugger instance
         * @param RequestStack $stack The stack instance
         * @param TranslatorInterface $translator The translator instance
         * @param SluggerUtil $slugger The slugger instance
         * @param RequestStack $stack The stack instance
         * @param TranslatorInterface $translator The translator instance
-        *
-        * {@inheritdoc}
         */
         */
-       public function __construct(HttpKernelInterface $httpKernel, HttpUtils $httpUtils, array $options, LoggerInterface $logger, ContainerInterface $container, ManagerRegistry $doctrine, MailerInterface $mailer, RouterInterface $router, SluggerUtil $slugger, RequestStack $stack, TranslatorInterface $translator) {
-               //Set config
-               $this->config = $container->getParameter(self::getAlias());
-
-               //Set doctrine
-               $this->doctrine = $doctrine;
-
-               //Set mailer
-               $this->mailer = $mailer;
-
-               //Set router
-               $this->router = $router;
-
-               //Set slugger
-               $this->slugger = $slugger;
-
-               //Set stack
-               $this->stack = $stack;
-
-               //Set translator
-               $this->translator = $translator;
-
+       public function __construct(protected HttpKernelInterface $httpKernel, protected HttpUtils $httpUtils, protected array $options, protected ?LoggerInterface $logger, protected ContainerInterface $container, protected ManagerRegistry $doctrine, protected MailerInterface $mailer, protected RouterInterface $router, protected SluggerUtil $slugger, protected RequestStack $stack, protected TranslatorInterface $translator) {
                //Call parent constructor
                parent::__construct($httpKernel, $httpUtils, $options, $logger);
                //Call parent constructor
                parent::__construct($httpKernel, $httpUtils, $options, $logger);
+
+               //Set config
+               $this->config = $container->getParameter(RapsysUserBundle::getAlias());
        }
 
        /**
        }
 
        /**
@@ -149,9 +103,9 @@ class AuthenticationFailureHandler extends DefaultAuthenticationFailureHandler {
        }
 
        /**
        }
 
        /**
-        * This is called when an interactive authentication attempt fails
-        *
         * {@inheritdoc}
         * {@inheritdoc}
+        *
+        * This is called when an interactive authentication attempt fails
         */
        public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response {
                //With bad credential exception
         */
        public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response {
                //With bad credential exception
@@ -348,11 +302,4 @@ class AuthenticationFailureHandler extends DefaultAuthenticationFailureHandler {
                //Call parent function
                return parent::onAuthenticationFailure($request, $exception);
        }
                //Call parent function
                return parent::onAuthenticationFailure($request, $exception);
        }
-
-       /**
-        * {@inheritdoc}
-        */
-       public function getAlias(): string {
-               return RapsysUserBundle::getAlias();
-       }
 }
 }