GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

StartAuthAction::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\LastFmBundle\Action;
13
14
use Core23\LastFm\Service\AuthServiceInterface;
15
use Symfony\Component\HttpFoundation\RedirectResponse;
16
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
17
use Symfony\Component\Routing\RouterInterface;
18
19
final class StartAuthAction
20
{
21
    /**
22
     * @var AuthServiceInterface
23
     */
24
    private $authService;
25
26
    /**
27
     * @var RouterInterface
28
     */
29
    private $router;
30
31
    public function __construct(AuthServiceInterface $authService, RouterInterface $router)
32
    {
33
        $this->authService = $authService;
34
        $this->router      = $router;
35
    }
36
37
    public function __invoke(): RedirectResponse
38
    {
39
        $callbackUrl = $this->generateUrl('core23_lastfm_check', [], UrlGeneratorInterface::ABSOLUTE_URL);
40
41
        return new RedirectResponse($this->authService->getAuthUrl($callbackUrl));
42
    }
43
44
    /**
45
     * Generates a URL from the given parameters.
46
     *
47
     * @param string $route         The name of the route
48
     * @param array  $parameters    An array of parameters
49
     * @param int    $referenceType The type of reference (one of the constants in UrlGeneratorInterface)
50
     *
51
     * @return string The generated URL
52
     */
53
    private function generateUrl(string $route, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): string
54
    {
55
        return $this->router->generate($route, $parameters, $referenceType);
56
    }
57
}
58