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.

SymfonyUrlGenerator   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 28
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A generate() 0 12 4
1
<?php
2
3
namespace Hateoas\UrlGenerator;
4
5
use Symfony\Component\Routing\Generator\UrlGeneratorInterface as SymfonyUrlGeneratorInterface;
6
7
/**
8
 * @author Adrien Brault <[email protected]>
9
 */
10
class SymfonyUrlGenerator implements UrlGeneratorInterface
11
{
12
    /**
13
     * @var SymfonyUrlGeneratorInterface
14
     */
15
    private $urlGenerator;
16
17
    public function __construct(SymfonyUrlGeneratorInterface $urlGenerator)
18
    {
19
        $this->urlGenerator = $urlGenerator;
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function generate($name, array $parameters, $absolute = false)
26
    {
27
        // If is it at least Symfony 2.8 and $absolute is passed as boolean
28
        if (SymfonyUrlGeneratorInterface::ABSOLUTE_PATH === 1 && is_bool($absolute)) {
29
            $absolute = $absolute
30
                ? SymfonyUrlGeneratorInterface::ABSOLUTE_URL
31
                : SymfonyUrlGeneratorInterface::ABSOLUTE_PATH
32
            ;
33
        }
34
35
        return $this->urlGenerator->generate($name, $parameters, $absolute);
36
    }
37
}
38