| Conditions | 3 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function __construct($html, $address) |
||
| 21 | { |
||
| 22 | $this->html = $html; |
||
| 23 | |||
| 24 | preg_match_all("~<a\s.*?>.*?</a>~imus", $html, $matches); |
||
| 25 | foreach ($matches[0] as &$match) { |
||
| 26 | $match = str_replace(["\n", "\r\n"], ' ', $match); |
||
| 27 | $match = preg_replace('~\s+~', ' ', $match); |
||
| 28 | } |
||
| 29 | $this->links = array_unique($matches[0]); |
||
| 30 | |||
| 31 | preg_match('~<base[^>]+href=[\'"](.*?)[\'"]~i', $html, $matches); |
||
| 32 | $this->base = !empty($matches[1]) ? Link::normalize($matches[1], $address) : $address; |
||
| 33 | } |
||
| 34 | } |