Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
51 | 6 | private static function makeSafer(string &$safe, string $letter) |
|
52 | { |
||
53 | // To properly obfuscate the value, we will randomly convert each letter to |
||
54 | // its entity or hexadecimal representation, keeping a bot from sniffing |
||
55 | // the randomly obfuscated letters out of the string on the responses. |
||
56 | 6 | switch (rand(1, 3)) { |
|
57 | 6 | case 1: |
|
58 | 6 | $safe .= '&#' . ord($letter).';'; |
|
59 | 6 | break; |
|
60 | |||
61 | 6 | case 2: |
|
62 | 6 | $safe .= '&#x' . dechex(ord($letter)).';'; |
|
63 | 6 | break; |
|
64 | |||
65 | 6 | case 3: |
|
66 | 6 | $safe .= $letter; |
|
67 | // no break |
||
68 | } |
||
69 | 6 | } |
|
70 | } |
||
71 |