<?php
namespace App\Responder\Security;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Error\SyntaxError;
/**
* Class LoginResponder
*/
class LoginResponder
{
/** @var Environment */
private $templating;
/**
* LoginResponder constructor.
*
* @param Environment $templating
*/
public function __construct(
Environment $templating
) {
$this->templating = $templating;
}
/**
* @param FormInterface $form
* @param AuthenticationException|null $error
*
* @return Response
* @throws LoaderError
* @throws RuntimeError
* @throws SyntaxError
*/
public function __invoke(FormInterface $form, AuthenticationException $error = null): Response
{
return new Response(
$this->templating->render('security/login.html.twig', [
'form' => $form->createView(),
])
);
}
}