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.
Completed
Push — master ( 9b1e74...69f903 )
by Christian
10:10
created

StartAuthAction::generateUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
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\AuthService;
15
use Symfony\Component\HttpFoundation\RedirectResponse;
16
use Symfony\Component\HttpFoundation\Response;
17
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
18
use Symfony\Component\Routing\RouterInterface;
19
20
final class StartAuthAction
21
{
22
    /**
23
     * @var AuthService
24
     */
25
    private $authService;
26
27
    /**
28
     * @var RouterInterface
29
     */
30
    private $router;
31
32
    /**
33
     * StartAuthAction constructor.
34
     *
35
     * @param AuthService     $authService
36
     * @param RouterInterface $router
37
     */
38
    public function __construct(AuthService $authService, RouterInterface $router)
39
    {
40
        $this->authService = $authService;
41
        $this->router      = $router;
42
    }
43
44
    /**
45
     * @return Response
46
     */
47
    public function __invoke(): Response
48
    {
49
        $callbackUrl = $this->generateUrl('core23_lastfm_check', [], UrlGeneratorInterface::ABSOLUTE_URL);
50
51
        return new RedirectResponse($this->authService->getAuthUrl($callbackUrl));
52
    }
53
54
    /**
55
     * Generates a URL from the given parameters.
56
     *
57
     * @param string $route         The name of the route
58
     * @param array  $parameters    An array of parameters
59
     * @param int    $referenceType The type of reference (one of the constants in UrlGeneratorInterface)
60
     *
61
     * @return string The generated URL
62
     */
63
    private function generateUrl($route, array $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): string
64
    {
65
        return $this->router->generate($route, $parameters, $referenceType);
66
    }
67
}
68