Code Duplication    Length = 3-5 lines in 2 locations

src/Link.php 2 locations

@@ 30-32 (lines=3) @@
27
        $link = explode('#', $link)[0];
28
29
        if ($link == '/') {
30
            if (!empty($this->components['scheme']) && !empty($this->components['host'])) {
31
                $this->url = $this->components['scheme'] . '://' . $this->components['host'];
32
            }
33
        } elseif (preg_match('~^//[^/].*~', $link)) {
34
            $scheme = $this->components['scheme'] ?? 'http';
35
            $this->url = $scheme . ':' . $link;
@@ 36-40 (lines=5) @@
33
        } elseif (preg_match('~^//[^/].*~', $link)) {
34
            $scheme = $this->components['scheme'] ?? 'http';
35
            $this->url = $scheme . ':' . $link;
36
        } elseif (preg_match('~^/[^/].*~', $link)) {
37
            if (!empty($this->components['scheme']) && !empty($this->components['host'])) {
38
                $this->url = $this->components['scheme'] . '://' . $this->components['host'] . $link;
39
            }
40
        } elseif (preg_match('~^https?://[^/].*~', $link)) {
41
            $this->url = $link;
42
        }
43
    }