| Total Complexity | 13 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 95.83% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class Link |
||
| 8 | { |
||
| 9 | private $url; |
||
| 10 | private $anchor; |
||
| 11 | private $element; |
||
| 12 | |||
| 13 | 12 | public function __construct(string $url, ?simple_html_dom_node $element = null) |
|
| 14 | { |
||
| 15 | 12 | $this->url = trim($url); |
|
| 16 | 12 | if (null !== $element) { |
|
| 17 | 12 | $this->setAnchor($element); |
|
| 18 | } |
||
| 19 | 12 | $this->element = $element; |
|
| 20 | 12 | } |
|
| 21 | |||
| 22 | 12 | protected function setAnchor(simple_html_dom_node $element) |
|
| 28 | } |
||
| 29 | 12 | } |
|
| 30 | |||
| 31 | 9 | public function getUrl() |
|
| 32 | { |
||
| 33 | 9 | return $this->url; |
|
| 34 | } |
||
| 35 | |||
| 36 | 3 | public function getPageUrl() |
|
| 37 | { |
||
| 38 | 3 | return preg_replace('/(\#.*)/si', '', $this->url); |
|
| 39 | } |
||
| 40 | |||
| 41 | 3 | public function getAnchor() |
|
| 42 | { |
||
| 43 | 3 | return $this->anchor; |
|
| 44 | } |
||
| 45 | |||
| 46 | 3 | public function getElement() |
|
| 47 | { |
||
| 48 | 3 | return $this->element; |
|
| 49 | } |
||
| 50 | |||
| 51 | 6 | public function mayFollow() |
|
| 60 | } |
||
| 61 | } |
||
| 62 |