SubscriptionTokenAssigner   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A assignTokenValue() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PH\Component\Core\Assigner;
6
7
use PH\Component\Core\Model\SubscriptionInterface;
8
use Sylius\Component\Resource\Generator\RandomnessGeneratorInterface;
9
10
final class SubscriptionTokenAssigner implements SubscriptionTokenAssignerInterface
11
{
12
    /**
13
     * @var RandomnessGeneratorInterface
14
     */
15
    private $generator;
16
17
    /**
18
     * @param RandomnessGeneratorInterface $generator
19
     */
20
    public function __construct(RandomnessGeneratorInterface $generator)
21
    {
22
        $this->generator = $generator;
23
    }
24
25
    /**
26
     * @param SubscriptionInterface $subscription
27
     */
28
    public function assignTokenValue(SubscriptionInterface $subscription): void
29
    {
30
        $subscription->setTokenValue($this->generator->generateUriSafeString(10));
31
    }
32
}
33