Lines 100.00% 8 / 8
Functions and Methods 100.00% 1 / 1
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
LoginFormController 100.00% 8 / 8 100.00% 1 / 1 1 100.00% 1 / 1
 __invoke 100.00% 8 / 8 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace App\Controller\Security;
6
7use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8use Symfony\Component\DependencyInjection\Attribute\Autowire;
9use Symfony\Component\HttpFoundation\Response;
10use Symfony\Component\Routing\Attribute\Route;
11use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
12
13#[Route('/login', name: 'app_login', methods: ['GET', 'POST'])]
14class LoginFormController extends AbstractController
15{
16    public function __invoke(
17        AuthenticationUtils $authenticationUtils,
18        #[Autowire('%env(OAUTH_GOOGLE_ID)%')] string $oauthGoogleId,
19    ): Response {
20        return $this->render(
21            'auth/login.html.twig',
22            [
23                'last_username' => $authenticationUtils->getLastUsername(),
24                'error' => $authenticationUtils->getLastAuthenticationError(),
25                'oauthGoogleId' => $oauthGoogleId,
26            ]
27        );
28    }
29}