| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public static function fromURL($url, ExternHttpClientInterface $httpClient,LoggerInterface $logger = null): ExternPage |
||
| 27 | { |
||
| 28 | if (!ExternHttpClient::isHttpURL($url)) { |
||
| 29 | throw new Exception('string is not an URL '.$url); |
||
| 30 | } |
||
| 31 | $html = $httpClient->getHTML($url, true); |
||
| 32 | if (empty($html)) { |
||
| 33 | throw new DomainException('No HTML from requested URL '.$url); |
||
| 34 | } |
||
| 35 | |||
| 36 | return new ExternPage($url, $html, new TagParser(), new InternetDomainParser(), $logger); |
||
| 37 | } |
||
| 40 |