Lines 0.00% 0 / 10
Methods 0.00% 0 / 2
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 connect 0.00% 0 / 9 0.00% 0 / 1 2
 connectCheck 0.00% 0 / 1 0.00% 0 / 1 2
10class GoogleController extends AbstractController
11{
12    /**
13     * Link to this controller to start the "connect" process.
14     */
15    #[Route(path: '/connect/google', name: 'connect_google_start', methods: ['GET'])]
16    public function connect(
17        ClientRegistry $clientRegistry
18    ): RedirectResponse {
19        return $clientRegistry
20            ->getClient('google')
21            ->redirect(
22                [
23                    'profile',
24                    'email', // the scopes you want to access
25                ],
26                []
27            );
28    }
29
30    /**
31     * After going to Google, you're redirected back here
32     * because this is the "redirect_route" you configured
33     * in config/packages/knpu_oauth2_client.yaml.
34     */
35    #[Route(path: '/connect/google/check', name: 'connect_google_check', methods: ['GET'])]
36    public function connectCheck(): RedirectResponse
37    {
38        return $this->redirectToRoute('app_default');
39    }
40}