We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4.0312 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | 68 | public static function decodeUrlSafe(string $value, bool $strict = true): string |
|
22 | { |
||
23 | 68 | $value = \str_replace(['-', '_'], ['+', '/'], $value); |
|
24 | |||
25 | 68 | if (0 === \strrpos($value, '=', -1) && 0 !== \strlen($value) % 4) { |
|
26 | $value = \str_pad($value, (\strlen($value) + 3) & ~3, '='); |
||
27 | } |
||
28 | |||
29 | 68 | $result = \base64_decode($value, $strict); |
|
30 | |||
31 | 68 | if (false === $result) { |
|
32 | 1 | throw new \InvalidArgumentException(\sprintf('The "%s" value failed to be decoded from base64 format.', $value)); |
|
33 | } |
||
34 | |||
35 | 67 | return $result; |
|
36 | } |
||
38 |