Completed
Push — master ( 3b0dd6...7275ed )
by Beñat
04:28 queued 01:27
created

PlainUserUrlGenerator::generate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 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\User\Infrastructure\Routing;
14
15
use BenGorUser\User\Domain\Model\UserUrlGenerator;
16
17
/**
18
 * Plain user URL generator class.
19
 *
20
 * @author Beñat Espiña <[email protected]>
21
 */
22
final class PlainUserUrlGenerator implements UserUrlGenerator
23
{
24
    /**
25
     * The url.
26
     *
27
     * @var string
28
     */
29
    private $url;
30
31
    /**
32
     * Constructor.
33
     *
34
     * @param string $anUrl The url
35
     */
36
    public function __construct($anUrl)
37
    {
38
        $this->url = $anUrl;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function generate($aToken)
45
    {
46
        return str_replace('{token}', $aToken, $this->url);
47
    }
48
}
49