ComparerToken   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A provide() 0 5 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Duje
5
 * Date: 29-May-18
6
 * Time: 2:34 PM
7
 */
8
declare(strict_types=1);
9
10
namespace Locastic\SyliusComparerPlugin\Utils;
11
12
use Sylius\Component\Resource\Generator\RandomnessGeneratorInterface;
13
14
final class ComparerToken implements ComparerTokenInterface
15
{
16
    /** @var RandomnessGeneratorInterface */
17
    private $randomGenerator;
18
19
    public function __construct(RandomnessGeneratorInterface $randomGenerator)
20
    {
21
        $this->randomGenerator = $randomGenerator;
22
    }
23
24
    public function provide(): string
25
    {
26
        $token = $this->randomGenerator->generateUriSafeString(self::TOKEN_LENGTH);
27
28
        return $token;
29
    }
30
}
31