@@ -170,7 +170,7 @@ |
||
170 | 170 | */ |
171 | 171 | public function __toString() |
172 | 172 | { |
173 | - return implode("\r\n", array_map(function (SetCookieHeader $cookie) { |
|
173 | + return implode("\r\n", array_map(function(SetCookieHeader $cookie) { |
|
174 | 174 | return (string) $cookie; |
175 | 175 | }, $this->cookies)); |
176 | 176 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | public function replaceAcceptedMimeTypes(array $mimeTypes) |
71 | 71 | { |
72 | 72 | self::$acceptedMimeTypes->clear(); |
73 | - $this->walkIn(function (UploadedFile &$file) { |
|
73 | + $this->walkIn(function(UploadedFile & $file) { |
|
74 | 74 | $file->getAcceptedMimeType()->clear(); |
75 | 75 | }); |
76 | 76 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $mimeType = strtolower(trim($mimeType)); |
106 | 106 | self::$acceptedMimeTypes->set($mimeType); |
107 | 107 | |
108 | - $this->walkIn(function (UploadedFile &$file) use ($mimeType) { |
|
108 | + $this->walkIn(function(UploadedFile & $file) use ($mimeType) { |
|
109 | 109 | $file->getAcceptedMimeType()->set($mimeType); |
110 | 110 | }); |
111 | 111 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | public function isValid() |
164 | 164 | { |
165 | 165 | try { |
166 | - $this->walkIn(function (UploadedFile $file) { |
|
166 | + $this->walkIn(function(UploadedFile $file) { |
|
167 | 167 | if (false === $file->isValid()) { |
168 | 168 | throw new \Exception; |
169 | 169 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | { |
189 | 189 | $successes = array(); |
190 | 190 | |
191 | - $this->walkIn(function (UploadedFile $file = null, $key, $parentKey = null) use ( |
|
191 | + $this->walkIn(function(UploadedFile $file = null, $key, $parentKey = null) use ( |
|
192 | 192 | &$successes, |
193 | 193 | &$closure, |
194 | 194 | &$lastKey |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function move($directory) |
220 | 220 | { |
221 | - return $this->createDirectoryAndCall($directory, function (UploadedFile $file) use ($directory) { |
|
221 | + return $this->createDirectoryAndCall($directory, function(UploadedFile $file) use ($directory) { |
|
222 | 222 | return $file->move($directory); |
223 | 223 | }); |
224 | 224 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function copy($directory) |
236 | 236 | { |
237 | - return $this->createDirectoryAndCall($directory, function (UploadedFile $file) use ($directory) { |
|
237 | + return $this->createDirectoryAndCall($directory, function(UploadedFile $file) use ($directory) { |
|
238 | 238 | return $file->copy($directory); |
239 | 239 | }); |
240 | 240 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public function deleteAll() |
248 | 248 | { |
249 | - $this->walkIn(function (UploadedFile $file) { |
|
249 | + $this->walkIn(function(UploadedFile $file) { |
|
250 | 250 | $file->remove(); |
251 | 251 | }); |
252 | 252 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | { |
263 | 263 | $messages = array(); |
264 | 264 | |
265 | - $this->walkIn(function (UploadedFile $file, $key, $parentKey = null) use (&$messages) { |
|
265 | + $this->walkIn(function(UploadedFile $file, $key, $parentKey = null) use (&$messages) { |
|
266 | 266 | $msg = $file->getErrorMessage(); |
267 | 267 | |
268 | 268 | if (null !== $msg) { |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | return $this->executeInSafeMode($caller); |
413 | 413 | } |
414 | 414 | |
415 | - throw new RuntimeException(implode(".\n", array_map(function ($message) { |
|
415 | + throw new RuntimeException(implode(".\n", array_map(function($message) { |
|
416 | 416 | if (is_array($message)) { |
417 | 417 | return implode(".\n", $message); |
418 | 418 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | { |
433 | 433 | $me = $this; |
434 | 434 | |
435 | - array_walk($data, function ($file, $key) use (&$callback, &$me, $parentKey) { |
|
435 | + array_walk($data, function($file, $key) use (&$callback, &$me, $parentKey) { |
|
436 | 436 | if (is_array($file)) { |
437 | 437 | $me->walkInRecursively($callback, $file, is_int($key) ? $parentKey : $key); |
438 | 438 | } |
@@ -197,8 +197,7 @@ |
||
197 | 197 | $uri = $this->getUri(); |
198 | 198 | if (empty($uri)) { |
199 | 199 | $this->basePath = ''; |
200 | - } |
|
201 | - else { |
|
200 | + } else { |
|
202 | 201 | if (basename($this->getUri()) === basename($this->server->get('SCRIPT_NAME'))) { |
203 | 202 | $basePath = dirname($this->getUri()); |
204 | 203 | } else { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | - return '/' . ltrim($this->pathInfo, '/'); |
|
128 | + return '/'.ltrim($this->pathInfo, '/'); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function getUriForPath($path) |
139 | 139 | { |
140 | - return $this->getUri() . '/' . trim($path, '/'); |
|
140 | + return $this->getUri().'/'.trim($path, '/'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | // build base url from last segment. |
162 | 162 | for ($i = count($parts) - 1; $i > 0; $i--) { |
163 | - $baseUri = '/' . $parts[$i] . $baseUri; |
|
163 | + $baseUri = '/'.$parts[$i].$baseUri; |
|
164 | 164 | $pos = strpos($path, $baseUri); |
165 | 165 | |
166 | 166 | // stop build when $baseUri not match with path. |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if (!empty($baseUri) && 0 === strpos(rawurldecode($requestUri), $baseUri)) { |
177 | 177 | $baseUri = rtrim($baseUri, DIRECTORY_SEPARATOR); |
178 | 178 | } elseif (!empty($baseUri) |
179 | - && strlen($requestUri) >= $len = strlen(rtrim(dirname($baseUri), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR)) { |
|
179 | + && strlen($requestUri) >= $len = strlen(rtrim(dirname($baseUri), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR)) { |
|
180 | 180 | $baseUri = rtrim(substr($requestUri, 0, $len), DIRECTORY_SEPARATOR); |
181 | 181 | } |
182 | 182 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getBaseUrl() |
52 | 52 | { |
53 | - return rtrim($this->schemaHost->getSchemaAndHttpHost() . $this->uri->getUri(), '/'); |
|
53 | + return rtrim($this->schemaHost->getSchemaAndHttpHost().$this->uri->getUri(), '/'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | { |
66 | 66 | $queryString = ''; |
67 | 67 | if (true === $withQueryString && (null !== $queryString = $this->queryString)) { |
68 | - $queryString = '?' . $queryString; |
|
68 | + $queryString = '?'.$queryString; |
|
69 | 69 | } |
70 | 70 | |
71 | - return $this->getBaseUrl() . '/' . trim($path, '/') . $queryString; |
|
71 | + return $this->getBaseUrl().'/'.trim($path, '/').$queryString; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | public function getFullUrl() |
80 | 80 | { |
81 | 81 | if (null !== $queryString = $this->queryString) { |
82 | - $queryString = '?' . $queryString; |
|
82 | + $queryString = '?'.$queryString; |
|
83 | 83 | } |
84 | 84 | |
85 | - return $this->getBaseUrl() . $this->uri->getPathInfo() . $queryString; |
|
85 | + return $this->getBaseUrl().$this->uri->getPathInfo().$queryString; |
|
86 | 86 | } |
87 | 87 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $str = http_build_query($query, '', '&'); |
344 | 344 | } |
345 | 345 | |
346 | - $server['REQUEST_URI'] = $path . (!empty($str) ? sprintf('?%s', $str) : ''); |
|
346 | + $server['REQUEST_URI'] = $path.(!empty($str) ? sprintf('?%s', $str) : ''); |
|
347 | 347 | $server['QUERY_STRING'] = $str; |
348 | 348 | |
349 | 349 | return $query; |
@@ -544,12 +544,12 @@ discard block |
||
544 | 544 | { |
545 | 545 | return |
546 | 546 | sprintf( |
547 | - '%s %s %s' . "\r\n", |
|
547 | + '%s %s %s'."\r\n", |
|
548 | 548 | $this->getMethod(), |
549 | 549 | $this->uri->getRequestUri(), |
550 | 550 | $this->server->get('SERVER_PROTOCOL') |
551 | - ) . |
|
552 | - $this->headers . "\r\n" . |
|
551 | + ). |
|
552 | + $this->headers."\r\n". |
|
553 | 553 | $this->getContent(); |
554 | 554 | } |
555 | 555 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if ('q' === $name) { |
69 | 69 | $this->setPriority($value); |
70 | 70 | } else { |
71 | - $this->parameters[$name] = (string)$value; |
|
71 | + $this->parameters[$name] = (string) $value; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return $this; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function fromString($itemString) |
85 | 85 | { |
86 | - preg_match_all('#((("[^"\']++")|(\'[^"\']++\'))|[^;"\'])+#', (string)$itemString, $parts); |
|
86 | + preg_match_all('#((("[^"\']++")|(\'[^"\']++\'))|[^;"\'])+#', (string) $itemString, $parts); |
|
87 | 87 | $bits = $parts[0]; |
88 | 88 | $fieldValue = array_shift($bits); |
89 | 89 | $parameters = array(); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function setPriority($priority) |
139 | 139 | { |
140 | - $priority = (float)$priority; |
|
140 | + $priority = (float) $priority; |
|
141 | 141 | |
142 | 142 | if (0 > $priority || 1 < $priority) { |
143 | 143 | throw new InvalidArgumentException(sprintf('Priority must between 0 - 1, "%s" give.', $priority)); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function setIndex($index) |
198 | 198 | { |
199 | - $this->index = (int)$index; |
|
199 | + $this->index = (int) $index; |
|
200 | 200 | |
201 | 201 | return $this; |
202 | 202 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function __toString() |
220 | 220 | { |
221 | - $string = $this->value . ($this->priority < 1 ? ';q=' . $this->priority : ''); |
|
221 | + $string = $this->value.($this->priority < 1 ? ';q='.$this->priority : ''); |
|
222 | 222 | |
223 | 223 | if (count($this->parameters)) { |
224 | 224 | foreach ($this->parameters as $name => $value) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public static function fromString($headerLine) |
62 | 62 | { |
63 | - $headerLine = (string)$headerLine; |
|
63 | + $headerLine = (string) $headerLine; |
|
64 | 64 | $pos = strpos($headerLine, ':'); |
65 | 65 | $fieldName = substr($headerLine, 0, $pos); |
66 | 66 | $fieldValue = null; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function getFieldValue() |
193 | 193 | { |
194 | - $parameters = implode(';', array_map(function ($key, $value) { |
|
194 | + $parameters = implode(';', array_map(function($key, $value) { |
|
195 | 195 | if (null === $value) { |
196 | 196 | return $key; |
197 | 197 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | return sprintf($format, $key, $value); |
202 | 202 | }, array_keys($this->parameters), $this->parameters)); |
203 | 203 | |
204 | - return $this->contentType . ($parameters ? ';' . $parameters : ''); |
|
204 | + return $this->contentType.($parameters ? ';'.$parameters : ''); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -416,13 +416,13 @@ |
||
416 | 416 | { |
417 | 417 | ksort($this->directives); |
418 | 418 | |
419 | - return implode(',', array_map(function ($key, $value = null) { |
|
419 | + return implode(',', array_map(function($key, $value = null) { |
|
420 | 420 | |
421 | 421 | if (null === $value) { |
422 | 422 | return $key; |
423 | 423 | } |
424 | 424 | |
425 | - return $key . '=' . $value; |
|
425 | + return $key.'='.$value; |
|
426 | 426 | }, array_keys($this->directives), $this->directives)); |
427 | 427 | } |
428 | 428 |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | $this->headers->set($this->computeCacheControl(), true); |
230 | 230 | |
231 | 231 | return |
232 | - sprintf(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)) . "\r\n" . |
|
233 | - $this->headers . "\r\n" . |
|
234 | - $this->cookies . "\r\n" . |
|
232 | + sprintf(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText))."\r\n". |
|
233 | + $this->headers."\r\n". |
|
234 | + $this->cookies."\r\n". |
|
235 | 235 | $content; |
236 | 236 | } |
237 | 237 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | foreach (explode("\r\n", $content) as $chunk) { |
410 | 410 | echo sprintf("%x\r\n", strlen($chunk)); |
411 | - echo $chunk . "\r\n"; |
|
411 | + echo $chunk."\r\n"; |
|
412 | 412 | flush(); |
413 | 413 | ob_flush(); |
414 | 414 | usleep($this->chunkDelayResponse); |