Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
28 | 1782 | public static function escape($string, $preserveEntities = false) |
|
29 | { |
||
30 | 1782 | if ($preserveEntities) { |
|
31 | 399 | $string = preg_replace('/[&](?;|[a-z][a-z0-9]{1,31};)/i', '&', $string); |
|
32 | 399 | } else { |
|
33 | 1779 | $string = str_replace('&', '&', $string); |
|
34 | } |
||
35 | |||
36 | 1782 | return str_replace(['<', '>', '"'], ['<', '>', '"'], $string); |
|
37 | } |
||
38 | } |
||
39 |