@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @static |
15 | 15 | * @return Resilient\Http\Uri |
16 | 16 | */ |
17 | - public static function createFromServer($serv) |
|
17 | + public static function createFromServer ($serv) |
|
18 | 18 | { |
19 | 19 | $scheme = isset($serv['HTTPS']) ? 'https://' : 'http://'; |
20 | 20 | $host = !empty($serv['HTTP_HOST']) ? $serv['HTTP_HOST'] : $serv['SERVER_NAME']; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param string $uri |
48 | 48 | * @return Resilient\Http\Uri |
49 | 49 | */ |
50 | - public static function createFromString(string $uri) |
|
50 | + public static function createFromString (string $uri) |
|
51 | 51 | { |
52 | 52 | $parts = parse_url($uri); |
53 | 53 | $scheme = isset($parts['scheme']) ? $parts['scheme'] : ''; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param string $user Uri user. |
76 | 76 | * @param string $password Uri password. |
77 | 77 | */ |
78 | - public function __construct( |
|
78 | + public function __construct ( |
|
79 | 79 | $scheme, |
80 | 80 | $host, |
81 | 81 | $port = null, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * {@inheritdoc} |
100 | 100 | */ |
101 | - public function getScheme() |
|
101 | + public function getScheme () |
|
102 | 102 | { |
103 | 103 | return $this->scheme; |
104 | 104 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | /** |
107 | 107 | * {@inheritdoc} |
108 | 108 | */ |
109 | - public function getAuthority() |
|
109 | + public function getAuthority () |
|
110 | 110 | { |
111 | 111 | $userInfo = $this->getUserInfo(); |
112 | 112 | $host = $this->getHost(); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * {@inheritdoc} |
120 | 120 | */ |
121 | - public function getUserInfo() |
|
121 | + public function getUserInfo () |
|
122 | 122 | { |
123 | 123 | return $this->user . ($this->password ? ':' . $this->password : ''); |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | /** |
127 | 127 | * {@inheritdoc} |
128 | 128 | */ |
129 | - public function getHost() |
|
129 | + public function getHost () |
|
130 | 130 | { |
131 | 131 | return $this->host; |
132 | 132 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | /** |
135 | 135 | * {@inheritdoc} |
136 | 136 | */ |
137 | - public function getPort() |
|
137 | + public function getPort () |
|
138 | 138 | { |
139 | 139 | return $this->port !== null && !$this->hasStandardPort() ? $this->port : null; |
140 | 140 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | /** |
143 | 143 | * {@inheritdoc} |
144 | 144 | */ |
145 | - public function getPath() |
|
145 | + public function getPath () |
|
146 | 146 | { |
147 | 147 | return $this->path; |
148 | 148 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | /** |
151 | 151 | * {@inheritdoc} |
152 | 152 | */ |
153 | - public function getQuery() |
|
153 | + public function getQuery () |
|
154 | 154 | { |
155 | 155 | return $this->query; |
156 | 156 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | /** |
159 | 159 | * {@inheritdoc} |
160 | 160 | */ |
161 | - public function getFragment() |
|
161 | + public function getFragment () |
|
162 | 162 | { |
163 | 163 | return $this->fragment; |
164 | 164 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | /** |
167 | 167 | * {@inheritdoc} |
168 | 168 | */ |
169 | - public function withScheme($scheme) |
|
169 | + public function withScheme ($scheme) |
|
170 | 170 | { |
171 | 171 | $scheme = $this->filterScheme($scheme); |
172 | 172 | $clone = clone $this; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | /** |
179 | 179 | * {@inheritdoc} |
180 | 180 | */ |
181 | - public function withUserInfo($user, $password = null) |
|
181 | + public function withUserInfo ($user, $password = null) |
|
182 | 182 | { |
183 | 183 | $clone = clone $this; |
184 | 184 | $clone->user = $user; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | /** |
191 | 191 | * {@inheritdoc} |
192 | 192 | */ |
193 | - public function withHost($host) |
|
193 | + public function withHost ($host) |
|
194 | 194 | { |
195 | 195 | $clone = clone $this; |
196 | 196 | $clone->host = $host; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | /** |
202 | 202 | * {@inheritdoc} |
203 | 203 | */ |
204 | - public function withPort($port) |
|
204 | + public function withPort ($port) |
|
205 | 205 | { |
206 | 206 | $port = $this->filterPort($port); |
207 | 207 | $clone = clone $this; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | /** |
214 | 214 | * {@inheritdoc} |
215 | 215 | */ |
216 | - public function withPath($path) |
|
216 | + public function withPath ($path) |
|
217 | 217 | { |
218 | 218 | $clone = clone $this; |
219 | 219 | $clone->path = $this->filterPath($path); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | /** |
225 | 225 | * {@inheritdoc} |
226 | 226 | */ |
227 | - public function withQuery($query) |
|
227 | + public function withQuery ($query) |
|
228 | 228 | { |
229 | 229 | return $this->withString($query); |
230 | 230 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | /** |
233 | 233 | * {@inheritdoc} |
234 | 234 | */ |
235 | - public function withFragment($fragment) |
|
235 | + public function withFragment ($fragment) |
|
236 | 236 | { |
237 | 237 | return $this->withString($fragment, 'fragment'); |
238 | 238 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param string $name (default: 'query') |
246 | 246 | * @return Uri |
247 | 247 | */ |
248 | - protected function withString($string, $name = 'query') |
|
248 | + protected function withString ($string, $name = 'query') |
|
249 | 249 | { |
250 | 250 | if (!is_string($string) && !method_exists($string, '__toString')) { |
251 | 251 | throw new InvalidArgumentException('Uri fragment must be a string'); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | /** |
261 | 261 | * {@inheritdoc} |
262 | 262 | */ |
263 | - public function __toString() |
|
263 | + public function __toString () |
|
264 | 264 | { |
265 | 265 | $scheme = $this->getScheme(); |
266 | 266 | $authority = $this->getAuthority(); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @return string $scheme |
288 | 288 | * @throws InvalidArgumentException if not corret scheme is present |
289 | 289 | */ |
290 | - protected function filterScheme(string $scheme) |
|
290 | + protected function filterScheme (string $scheme) |
|
291 | 291 | { |
292 | 292 | static $valid = [ |
293 | 293 | '' => true, |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @return null|integer $port |
313 | 313 | * @throws InvalidArgumentException for incorrect port assigned |
314 | 314 | */ |
315 | - protected function filterPort($port) |
|
315 | + protected function filterPort ($port) |
|
316 | 316 | { |
317 | 317 | if ((integer) $port >= 0 && (integer) $port <= 65535) { |
318 | 318 | return $port; |
@@ -328,11 +328,11 @@ discard block |
||
328 | 328 | * @param string $path |
329 | 329 | * @return string of cleared path |
330 | 330 | */ |
331 | - protected function filterPath($path) |
|
331 | + protected function filterPath ($path) |
|
332 | 332 | { |
333 | 333 | return preg_replace_callback( |
334 | 334 | '/(?:[^a-zA-Z0-9_\-\.~:@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', |
335 | - function ($match) { |
|
335 | + function($match) { |
|
336 | 336 | return rawurlencode($match[0]); |
337 | 337 | }, |
338 | 338 | $path |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | * @param string $query |
347 | 347 | * @return string of replaced query |
348 | 348 | */ |
349 | - protected function filterQuery($query) |
|
349 | + protected function filterQuery ($query) |
|
350 | 350 | { |
351 | 351 | return preg_replace_callback( |
352 | 352 | '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/', |
353 | - function ($match) { |
|
353 | + function($match) { |
|
354 | 354 | return rawurlencode($match[0]); |
355 | 355 | }, |
356 | 356 | $query |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * @access protected |
364 | 364 | * @return boolean |
365 | 365 | */ |
366 | - protected function hasStandardPort() |
|
366 | + protected function hasStandardPort () |
|
367 | 367 | { |
368 | 368 | return ($this->scheme === 'http' && $this->port === 80) || ($this->scheme === 'https' && $this->port === 443); |
369 | 369 | } |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | * @access public |
375 | 375 | * @return string |
376 | 376 | */ |
377 | - public function getBaseUrl() |
|
377 | + public function getBaseUrl () |
|
378 | 378 | { |
379 | 379 | $scheme = $this->getScheme(); |
380 | 380 | $authority = $this->getAuthority(); |