TokenFactory::generateUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Recca0120\LaravelPayum\Security;
4
5
use Payum\Core\Storage\StorageInterface;
6
use Payum\Core\Security\AbstractTokenFactory;
7
use Illuminate\Contracts\Routing\UrlGenerator;
8
use Payum\Core\Registry\StorageRegistryInterface;
9
10
class TokenFactory extends AbstractTokenFactory
11
{
12
    /**
13
     * $urlGenerator.
14
     *
15
     * @var \Illuminate\Contracts\Routing\UrlGenerator
16
     */
17
    protected $urlGenerator;
18
19
    /**
20
     * __construct.
21
     *
22
     * @param \Payum\Core\Storage\StorageInterface $tokenStorage
23
     * @param \Payum\Core\Registry\StorageRegistryInterface $storageRegistry
24
     * @param \Illuminate\Contracts\Routing\UrlGenerator $urlGenerator
25
     */
26 2
    public function __construct(StorageInterface $tokenStorage, StorageRegistryInterface $storageRegistry, UrlGenerator $urlGenerator)
27
    {
28 2
        $this->tokenStorage = $tokenStorage;
29 2
        $this->storageRegistry = $storageRegistry;
30 2
        $this->urlGenerator = $urlGenerator;
31 2
    }
32
33
    /**
34
     * generateUrl.
35
     *
36
     * @param string $path
37
     * @param array $parameters
38
     * @return string
39
     */
40 1
    protected function generateUrl($path, array $parameters = [])
41
    {
42 1
        return $this->urlGenerator->route($path, $parameters);
43
    }
44
}
45