Conditions | 4 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
40 | 288 | public static function filter(string $html, string $filter): string |
|
41 | { |
||
42 | switch ($filter) { |
||
43 | 288 | case self::STRIP: |
|
44 | 12 | return ''; |
|
45 | 276 | case self::ESCAPE: |
|
46 | 12 | return \htmlspecialchars($html, \ENT_NOQUOTES); |
|
47 | 264 | case self::ALLOW: |
|
48 | 261 | return $html; |
|
49 | default: |
||
50 | 3 | throw new \InvalidArgumentException(\sprintf('Invalid filter provided: "%s"', $filter)); |
|
51 | } |
||
54 |