1 | <?php |
||
5 | class Url |
||
6 | { |
||
7 | /** @var null|string */ |
||
8 | public $scheme; |
||
9 | |||
10 | /** @var null|string */ |
||
11 | public $host; |
||
12 | |||
13 | /** @var int */ |
||
14 | public $port = 80; |
||
15 | |||
16 | /** @var null|string */ |
||
17 | public $path; |
||
18 | |||
19 | /** @var null|string */ |
||
20 | public $query; |
||
21 | |||
22 | /** @var \Spatie\Crawler\HtmlNode */ |
||
23 | public $node; |
||
24 | |||
25 | /** |
||
26 | * @param HtmlNode $node |
||
27 | * |
||
28 | * @return static |
||
29 | */ |
||
30 | public static function create(HtmlNode $node) |
||
34 | |||
35 | /** |
||
36 | * @param string $url |
||
37 | * |
||
38 | * @return static |
||
39 | */ |
||
40 | public static function createFromString(string $url) |
||
44 | |||
45 | public function __construct($node, $url = null) |
||
61 | |||
62 | public function isRelative(): bool |
||
66 | |||
67 | public function isProtocolIndependent(): bool |
||
71 | |||
72 | public function hasCrawlableScheme(): bool |
||
76 | |||
77 | /** |
||
78 | * @param string $scheme |
||
79 | * |
||
80 | * @return $this |
||
81 | */ |
||
82 | public function setScheme(string $scheme) |
||
88 | |||
89 | /** |
||
90 | * @param string $host |
||
91 | * |
||
92 | * @return $this |
||
93 | */ |
||
94 | public function setHost(string $host) |
||
100 | |||
101 | /** |
||
102 | * @param $port |
||
103 | * |
||
104 | * @return $this |
||
105 | */ |
||
106 | public function setPort(int $port) |
||
112 | |||
113 | /** |
||
114 | * @return $this |
||
115 | */ |
||
116 | public function removeFragment() |
||
122 | |||
123 | /** |
||
124 | * @return null|string |
||
125 | */ |
||
126 | public function path() |
||
130 | |||
131 | /** |
||
132 | * @param int|null $index |
||
133 | * |
||
134 | * @return array|null|string |
||
135 | */ |
||
136 | public function segments(int $index = null) |
||
151 | |||
152 | /** |
||
153 | * @param int $index |
||
154 | * |
||
155 | * @return string|null |
||
156 | */ |
||
157 | public function segment(int $index) |
||
165 | |||
166 | public function isEqual(Url $otherUrl): bool |
||
170 | |||
171 | /** |
||
172 | * @return string |
||
173 | */ |
||
174 | public function __toString() |
||
184 | |||
185 | /** |
||
186 | * @param string|null $haystack |
||
187 | * @param string|array $needles |
||
188 | * |
||
189 | * @return bool |
||
190 | */ |
||
191 | public function startsWith($haystack, $needles): bool |
||
201 | } |
||
202 |
This checks looks for cases where a variable has been assigned to itself.
This assignement can be removed without consequences.