| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | 6 | public static function valid($content) |
|
| 8 | { |
||
| 9 | 6 | $content = trim($content); |
|
| 10 | 6 | if (empty($content)) { |
|
| 11 | 2 | return false; |
|
| 12 | } |
||
| 13 | |||
| 14 | 4 | libxml_use_internal_errors(true); |
|
| 15 | 4 | libxml_clear_errors(); |
|
| 16 | 4 | simplexml_load_string($content); |
|
| 17 | 4 | $errors = libxml_get_errors(); |
|
| 18 | 4 | libxml_clear_errors(); |
|
| 19 | 4 | return empty($errors); |
|
| 20 | } |
||
| 21 | } |
||
| 22 |