Conditions | 1 |
Paths | 1 |
Total Lines | 6 |
Code Lines | 2 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | 5 | public static function apply(string $token): string |
|
26 | { |
||
27 | // The number of bytes in a mask is always equal to the number of bytes in a token. |
||
28 | /** @psalm-suppress ArgumentTypeCoercion */ |
||
29 | 5 | $mask = random_bytes(StringHelper::byteLength($token)); |
|
30 | 4 | return StringHelper::base64UrlEncode($mask . ($mask ^ $token)); |
|
31 | } |
||
52 |