Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
28 | public static function fromURL($url, ?Log $log = null): ExternPage |
||
29 | { |
||
30 | if (!ExternHttpClient::isWebURL($url)) { |
||
31 | throw new \Exception('string is not an URL'); |
||
32 | } |
||
33 | $adapter = new ExternHttpClient($log); |
||
34 | $html = $adapter->getHTML($url); |
||
35 | $html = \Normalizer::normalize($html); |
||
36 | if (empty($html)) { |
||
37 | throw new \DomainException('No HTML from requested URL'); |
||
38 | } |
||
39 | |||
40 | return new ExternPage($url, $html, $log); |
||
41 | } |
||
43 |