SymfonyUserUrlGenerator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 40
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A generate() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of the BenGorUser package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace BenGorUser\SymfonyRoutingBridge\Infrastructure\Routing;
14
15
use BenGorUser\User\Domain\Model\UserUrlGenerator;
16
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
17
18
/**
19
 * Symfony user URL generator class.
20
 *
21
 * @author Beñat Espiña <[email protected]>
22
 */
23
final class SymfonyUserUrlGenerator implements UserUrlGenerator
24
{
25
    /**
26
     * The URL generator.
27
     *
28
     * @var UrlGeneratorInterface
29
     */
30
    private $urlGenerator;
31
32
    /**
33
     * The path name.
34
     *
35
     * @var string
36
     */
37
    private $pathName;
38
39
    /**
40
     * Constructor.
41
     *
42
     * @param UrlGeneratorInterface $anUrlGenerator The URL generator
43
     * @param string                $aPathName      The path name
44
     */
45
    public function __construct(UrlGeneratorInterface $anUrlGenerator, $aPathName)
46
    {
47
        $this->urlGenerator = $anUrlGenerator;
48
        $this->pathName = $aPathName;
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function generate($aToken)
55
    {
56
        return $this->urlGenerator->generate(
57
            $this->pathName,
58
            ['token' => $aToken],
59
            UrlGeneratorInterface::ABSOLUTE_URL
60
        );
61
    }
62
}
63