@@ -27,12 +27,12 @@ |
||
27 | 27 | |
28 | 28 | protected function _validate() : string |
29 | 29 | { |
30 | - if(!is_string($this->value)) { |
|
30 | + if (!is_string($this->value)) { |
|
31 | 31 | return ''; |
32 | 32 | } |
33 | 33 | |
34 | 34 | $info = parseURL($this->value); |
35 | - if($info->isValid()) { |
|
35 | + if ($info->isValid()) { |
|
36 | 36 | return $this->value; |
37 | 37 | } |
38 | 38 |
@@ -31,13 +31,13 @@ |
||
31 | 31 | |
32 | 32 | protected function _validate() : string |
33 | 33 | { |
34 | - if(!is_string($this->value)) { |
|
34 | + if (!is_string($this->value)) { |
|
35 | 35 | return ''; |
36 | 36 | } |
37 | 37 | |
38 | 38 | $value = trim($this->value); |
39 | 39 | |
40 | - if(empty($value)) { |
|
40 | + if (empty($value)) { |
|
41 | 41 | return ''; |
42 | 42 | } |
43 | 43 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | protected function _validate() |
32 | 32 | { |
33 | - if(is_numeric($this->value)) { |
|
33 | + if (is_numeric($this->value)) { |
|
34 | 34 | return $this->value * 1; |
35 | 35 | } |
36 | 36 |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | |
39 | 39 | private function filterScheme() : void |
40 | 40 | { |
41 | - if($this->hasScheme()) |
|
41 | + if ($this->hasScheme()) |
|
42 | 42 | { |
43 | 43 | $this->setScheme(strtolower($this->getScheme())); |
44 | 44 | } |
45 | 45 | else |
46 | 46 | { |
47 | 47 | $scheme = URISchemes::detectScheme($this->url); |
48 | - if(!empty($scheme)) { |
|
48 | + if (!empty($scheme)) { |
|
49 | 49 | $this->setScheme(URISchemes::resolveSchemeName($scheme)); |
50 | 50 | } |
51 | 51 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | private function filterAuth() : void |
55 | 55 | { |
56 | - if(!$this->hasAuth()) { |
|
56 | + if (!$this->hasAuth()) { |
|
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | private function filterHost() : void |
67 | 67 | { |
68 | - if(!$this->hasHost()) |
|
68 | + if (!$this->hasHost()) |
|
69 | 69 | { |
70 | 70 | return; |
71 | 71 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | private function filterPath() : void |
80 | 80 | { |
81 | - if($this->hasPath()) { |
|
81 | + if ($this->hasPath()) { |
|
82 | 82 | $this->setPath(str_replace(' ', '', $this->getPath())); |
83 | 83 | } |
84 | 84 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | { |
88 | 88 | $host = $this->getPath(); |
89 | 89 | |
90 | - if(empty($host) || !URLHosts::isHostKnown($host)) |
|
90 | + if (empty($host) || !URLHosts::isHostKnown($host)) |
|
91 | 91 | { |
92 | 92 | return; |
93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $this->setHost($host); |
96 | 96 | $this->removePath(); |
97 | 97 | |
98 | - if(!$this->hasScheme()) { |
|
98 | + if (!$this->hasScheme()) { |
|
99 | 99 | $this->setSchemeHTTPS(); |
100 | 100 | } |
101 | 101 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $this->info['params'] = array(); |
106 | 106 | |
107 | 107 | $query = $this->getQuery(); |
108 | - if(empty($query)) { |
|
108 | + if (empty($query)) { |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | // if the URL contains any URL characters, and we |
115 | 115 | // do not want them URL encoded, restore them. |
116 | - if(!$this->encodeUTF && !empty($this->unicodeChars)) |
|
116 | + if (!$this->encodeUTF && !empty($this->unicodeChars)) |
|
117 | 117 | { |
118 | 118 | $this->info = $this->restoreUnicodeChars($this->info); |
119 | 119 | } |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | |
131 | 131 | $keep = array(); |
132 | 132 | |
133 | - foreach($chars as $char) |
|
133 | + foreach ($chars as $char) |
|
134 | 134 | { |
135 | - if(preg_match('/\p{L}/uix', $char)) |
|
135 | + if (preg_match('/\p{L}/uix', $char)) |
|
136 | 136 | { |
137 | 137 | $encoded = rawurlencode($char); |
138 | 138 | |
139 | - if($encoded !== $char) |
|
139 | + if ($encoded !== $char) |
|
140 | 140 | { |
141 | 141 | $this->unicodeChars[$encoded] = $char; |
142 | 142 | $char = $encoded; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | protected function detectType() : bool |
153 | 153 | { |
154 | - foreach(self::$detectorClasses as $className) |
|
154 | + foreach (self::$detectorClasses as $className) |
|
155 | 155 | { |
156 | 156 | $detector = ClassHelper::requireObjectInstanceOf( |
157 | 157 | BaseURLTypeDetector::class, |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // Use the adjusted data |
164 | 164 | $this->info = $detector->getInfo(); |
165 | 165 | |
166 | - if($detected) { |
|
166 | + if ($detected) { |
|
167 | 167 | $this->isValid = true; |
168 | 168 | return true; |
169 | 169 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | protected function validate() : void |
176 | 176 | { |
177 | - foreach(self::$validatorClasses as $validatorClass) |
|
177 | + foreach (self::$validatorClasses as $validatorClass) |
|
178 | 178 | { |
179 | 179 | $validator = ClassHelper::requireObjectInstanceOf( |
180 | 180 | BaseURLValidator::class, |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | $this->info = $validator->getInfo(); |
187 | 187 | |
188 | - if($result !== true) { |
|
188 | + if ($result !== true) { |
|
189 | 189 | $this->isValid = false; |
190 | 190 | return; |
191 | 191 | } |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | { |
216 | 216 | $result = array(); |
217 | 217 | |
218 | - foreach($subject as $key => $val) |
|
218 | + foreach ($subject as $key => $val) |
|
219 | 219 | { |
220 | - if(is_array($val)) |
|
220 | + if (is_array($val)) |
|
221 | 221 | { |
222 | 222 | $val = $this->restoreUnicodeChars($val); |
223 | 223 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | protected function restoreUnicodeChar(string $string) : string |
245 | 245 | { |
246 | - if(strpos($string, '%') !== false) |
|
246 | + if (strpos($string, '%') !== false) |
|
247 | 247 | { |
248 | 248 | return str_replace(array_keys($this->unicodeChars), array_values($this->unicodeChars), $string); |
249 | 249 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | public static function addHost(string $host) : void |
19 | 19 | { |
20 | - if(!self::isHostKnown($host)) { |
|
20 | + if (!self::isHostKnown($host)) { |
|
21 | 21 | self::$knownHosts[] = strtolower($host); |
22 | 22 | } |
23 | 23 | } |