Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | 13 | public static function loadHtml(string $html, array $options = []): \DOMDocument |
|
29 | { |
||
30 | 13 | $parser = new HTML5(); |
|
31 | |||
32 | // Load Document |
||
33 | 13 | $doc = $parser->loadHTML($html, $options); |
|
34 | 13 | if ($parser->hasErrors()) { |
|
35 | 1 | throw new Html5Exception(null, 0, array_map( |
|
36 | 1 | function ($message) use ($html) { |
|
37 | 1 | return new Html5ParseException($message, $html); |
|
38 | 1 | }, |
|
39 | |||
40 | 1 | $parser->getErrors(), |
|
41 | 1 | )); |
|
42 | } |
||
43 | |||
44 | 12 | return $doc; |
|
45 | } |
||
65 |