Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
32 | 6 | public static function unmask(string $maskedToken): string |
|
33 | { |
||
34 | 6 | $decoded = StringHelper::base64UrlDecode($maskedToken); |
|
35 | 6 | $length = StringHelper::byteLength($decoded) / 2; |
|
36 | // Check if the masked token has an even length. |
||
37 | 6 | if (!is_int($length)) { |
|
|
|||
38 | 1 | return ''; |
|
39 | } |
||
40 | |||
41 | 5 | return StringHelper::byteSubstr($decoded, $length, $length) ^ StringHelper::byteSubstr($decoded, 0, $length); |
|
42 | } |
||
44 |