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