src/Responder/Security/LoginResponder.php line 41

Open in your IDE?
  1. <?php
  2. namespace App\Responder\Security;
  3. use Symfony\Component\Form\FormInterface;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Security\Core\Exception\AuthenticationException;
  6. use Twig\Environment;
  7. use Twig\Error\LoaderError;
  8. use Twig\Error\RuntimeError;
  9. use Twig\Error\SyntaxError;
  10. /**
  11.  * Class LoginResponder
  12.  */
  13. class LoginResponder
  14. {
  15.     /** @var Environment */
  16.     private $templating;
  17.     /**
  18.      * LoginResponder constructor.
  19.      *
  20.      * @param Environment $templating
  21.      */
  22.     public function __construct(
  23.         Environment $templating
  24.     ) {
  25.         $this->templating $templating;
  26.     }
  27.     /**
  28.      * @param FormInterface $form
  29.      * @param AuthenticationException|null $error
  30.      *
  31.      * @return Response
  32.      * @throws LoaderError
  33.      * @throws RuntimeError
  34.      * @throws SyntaxError
  35.      */
  36.     public function __invoke(FormInterface $formAuthenticationException $error null): Response
  37.     {
  38.         return new Response(
  39.             $this->templating->render('security/login.html.twig', [
  40.                 'form' => $form->createView(),
  41.             ])
  42.         );
  43.     }
  44. }