Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
22 | 3 | public static function redact($value): string |
|
23 | { |
||
24 | 3 | $total = strlen($value); |
|
25 | 3 | $tenth = ceil($total / 10); |
|
26 | |||
27 | // Make sure single character strings get redacted |
||
28 | 3 | $length = ($total > $tenth) ? ($total - $tenth) : 1; |
|
29 | |||
30 | 3 | return str_pad(substr($value, $length), $total, '#', STR_PAD_LEFT); |
|
|
|||
31 | } |
||
33 |