Conditions | 3 |
Paths | 2 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
23 | public function __invoke(SessionInterface $session) : string |
||
24 | 12 | { |
|
25 | $uniqueKey = $session->get($this->uniqueIdKey, ''); |
||
26 | 12 | ||
27 | if ('' === $uniqueKey || ! is_string($uniqueKey)) { |
||
28 | 12 | $generatedKey = bin2hex(random_bytes(self::ENTROPY)); |
|
29 | 8 | ||
30 | $session->set($this->uniqueIdKey, $generatedKey); |
||
31 | 8 | ||
32 | return $generatedKey; |
||
33 | 8 | } |
|
34 | |||
35 | return $uniqueKey; |
||
36 | 4 | } |
|
37 | } |
||
38 |