Total Complexity | 9 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class WebPageHandler implements Handler |
||
13 | { |
||
14 | protected string $url; |
||
15 | |||
16 | protected string $html; |
||
17 | |||
18 | protected DOMDocument $dom; |
||
19 | |||
20 | public function __construct ( string $url ) |
||
21 | { |
||
22 | $this->url = $url; |
||
23 | $this->html = ""; |
||
24 | $this->dom = new DOMDocument(); |
||
25 | } |
||
26 | |||
27 | public function getUrl () : string |
||
28 | { |
||
29 | return $this->url; |
||
30 | } |
||
31 | |||
32 | public function setUrl ( string $url ) : void |
||
33 | { |
||
34 | $this->url = $url; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @throws SourceWatcherException |
||
39 | */ |
||
40 | public function read () : void |
||
64 | } |
||
65 | } |
||
66 | |||
67 | public function getHtml () : string |
||
68 | { |
||
69 | return $this->html; |
||
70 | } |
||
71 | |||
72 | public function getDom () : DOMDocument |
||
75 | } |
||
76 | } |
||
77 |
If you suppress an error, we recommend checking for the error condition explicitly: