@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public static function create($data = '', $type = '', $code = 200, array $header = [], $options = []) |
106 | 106 | { |
107 | - $class = false !== strpos($type, '\\') ? $type : '\\think\\response\\' . ucfirst(strtolower($type)); |
|
107 | + $class = false !== strpos($type, '\\') ? $type : '\\think\\response\\'.ucfirst(strtolower($type)); |
|
108 | 108 | |
109 | 109 | if (class_exists($class)) { |
110 | 110 | return new $class($data, $code, $header, $options); |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | if (200 == $this->code && $this->allowCache) { |
136 | 136 | $cache = $this->app['request']->getCache(); |
137 | 137 | if ($cache) { |
138 | - $this->header['Cache-Control'] = 'max-age=' . $cache[1] . ',must-revalidate'; |
|
139 | - $this->header['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT'; |
|
140 | - $this->header['Expires'] = gmdate('D, d M Y H:i:s', $_SERVER['REQUEST_TIME'] + $cache[1]) . ' GMT'; |
|
138 | + $this->header['Cache-Control'] = 'max-age='.$cache[1].',must-revalidate'; |
|
139 | + $this->header['Last-Modified'] = gmdate('D, d M Y H:i:s').' GMT'; |
|
140 | + $this->header['Expires'] = gmdate('D, d M Y H:i:s', $_SERVER['REQUEST_TIME'] + $cache[1]).' GMT'; |
|
141 | 141 | |
142 | 142 | $this->app['cache']->tag($cache[2])->set($cache[0], [$data, $this->header], $cache[1]); |
143 | 143 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | http_response_code($this->code); |
149 | 149 | // 发送头部信息 |
150 | 150 | foreach ($this->header as $name => $val) { |
151 | - header($name . (!is_null($val) ? ':' . $val : '')); |
|
151 | + header($name.(!is_null($val) ? ':'.$val : '')); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | */ |
356 | 356 | public function contentType($contentType, $charset = 'utf-8') |
357 | 357 | { |
358 | - $this->header['Content-Type'] = $contentType . '; charset=' . $charset; |
|
358 | + $this->header['Content-Type'] = $contentType.'; charset='.$charset; |
|
359 | 359 | |
360 | 360 | return $this; |
361 | 361 | } |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | $config = $this->config; |
103 | 103 | } |
104 | 104 | |
105 | - $name = $config['prefix'] . $name; |
|
105 | + $name = $config['prefix'].$name; |
|
106 | 106 | |
107 | 107 | // 设置cookie |
108 | 108 | if (is_array($value)) { |
109 | 109 | array_walk_recursive($value, [$this, 'jsonFormatProtect'], 'encode'); |
110 | - $value = 'think:' . json_encode($value); |
|
110 | + $value = 'think:'.json_encode($value); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $expire = !empty($config['expire']) ? $_SERVER['REQUEST_TIME'] + intval($config['expire']) : 0; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | public function has($name, $prefix = null) |
163 | 163 | { |
164 | 164 | $prefix = !is_null($prefix) ? $prefix : $this->config['prefix']; |
165 | - $name = $prefix . $name; |
|
165 | + $name = $prefix.$name; |
|
166 | 166 | |
167 | 167 | return isset($_COOKIE[$name]); |
168 | 168 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | public function get($name = '', $prefix = null) |
178 | 178 | { |
179 | 179 | $prefix = !is_null($prefix) ? $prefix : $this->config['prefix']; |
180 | - $key = $prefix . $name; |
|
180 | + $key = $prefix.$name; |
|
181 | 181 | |
182 | 182 | if ('' == $name) { |
183 | 183 | if ($prefix) { |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | { |
217 | 217 | $config = $this->config; |
218 | 218 | $prefix = !is_null($prefix) ? $prefix : $config['prefix']; |
219 | - $name = $prefix . $name; |
|
219 | + $name = $prefix.$name; |
|
220 | 220 | |
221 | 221 | if ($config['setcookie']) { |
222 | 222 | $this->setcookie($name, '', $_SERVER['REQUEST_TIME'] - 3600, $config); |
@@ -213,7 +213,7 @@ |
||
213 | 213 | $options = $this->options; |
214 | 214 | |
215 | 215 | $arguments = array_merge($this->prefix, $this->arguments); |
216 | - $script = implode(' ', array_map([__NAMESPACE__ . '\\Utils', 'escapeArgument'], $arguments)); |
|
216 | + $script = implode(' ', array_map([__NAMESPACE__.'\\Utils', 'escapeArgument'], $arguments)); |
|
217 | 217 | |
218 | 218 | if ($this->inheritEnv) { |
219 | 219 | // include $_ENV for BC purposes |
@@ -24,7 +24,7 @@ |
||
24 | 24 | throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.'); |
25 | 25 | } |
26 | 26 | |
27 | - $error = sprintf('The command "%s" failed.' . "\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText()); |
|
27 | + $error = sprintf('The command "%s" failed.'."\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText()); |
|
28 | 28 | |
29 | 29 | if (!$process->isOutputDisabled()) { |
30 | 30 | $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", $process->getOutput(), $process->getErrorOutput()); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $escapedArgument .= '\\"'; |
31 | 31 | } elseif (self::isSurroundedBy($part, '%')) { |
32 | 32 | // Avoid environment variable expansion |
33 | - $escapedArgument .= '^%"' . substr($part, 1, -1) . '"^%'; |
|
33 | + $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%'; |
|
34 | 34 | } else { |
35 | 35 | // escape trailing backslash |
36 | 36 | if ('\\' === substr($part, -1)) { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | if ($quote) { |
44 | - $escapedArgument = '"' . $escapedArgument . '"'; |
|
44 | + $escapedArgument = '"'.$escapedArgument.'"'; |
|
45 | 45 | } |
46 | 46 | return $escapedArgument; |
47 | 47 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | public function toArray() |
49 | 49 | { |
50 | - return array_map(function ($value) { |
|
50 | + return array_map(function($value) { |
|
51 | 51 | return ($value instanceof Model || $value instanceof self) ? $value->toArray() : $value; |
52 | 52 | }, $this->items); |
53 | 53 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $operator = '='; |
345 | 345 | } |
346 | 346 | |
347 | - return $this->filter(function ($data) use ($field, $operator, $value) { |
|
347 | + return $this->filter(function($data) use ($field, $operator, $value) { |
|
348 | 348 | if (strpos($field, '.')) { |
349 | 349 | list($field, $relation) = explode('.', $field); |
350 | 350 | |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | { |
415 | 415 | $items = $this->items; |
416 | 416 | |
417 | - $callback = $callback ?: function ($a, $b) { |
|
417 | + $callback = $callback ?: function($a, $b) { |
|
418 | 418 | return $a == $b ? 0 : (($a < $b) ? -1 : 1); |
419 | 419 | |
420 | 420 | }; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public function order($field, $order = null, $intSort = true) |
436 | 436 | { |
437 | - return $this->sort(function ($a, $b) use ($field, $order, $intSort) { |
|
437 | + return $this->sort(function($a, $b) use ($field, $order, $intSort) { |
|
438 | 438 | $fieldA = isset($a[$field]) ? $a[$field] : null; |
439 | 439 | $fieldB = isset($b[$field]) ? $b[$field] : null; |
440 | 440 |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | |
151 | 151 | $url = $path; |
152 | 152 | if (!empty($parameters)) { |
153 | - $url .= '?' . http_build_query($parameters, null, '&'); |
|
153 | + $url .= '?'.http_build_query($parameters, null, '&'); |
|
154 | 154 | } |
155 | 155 | |
156 | - return $url . $this->buildFragment(); |
|
156 | + return $url.$this->buildFragment(); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | protected function buildFragment() |
290 | 290 | { |
291 | - return $this->options['fragment'] ? '#' . $this->options['fragment'] : ''; |
|
291 | + return $this->options['fragment'] ? '#'.$this->options['fragment'] : ''; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -57,7 +57,7 @@ |
||
57 | 57 | throw new \InvalidArgumentException(json_last_error_msg()); |
58 | 58 | } |
59 | 59 | |
60 | - $data = $handler . '(' . $data . ');'; |
|
60 | + $data = $handler.'('.$data.');'; |
|
61 | 61 | |
62 | 62 | return $data; |
63 | 63 | } catch (\Exception $e) { |
@@ -48,7 +48,7 @@ |
||
48 | 48 | if (0 !== strpos($data, '<?xml')) { |
49 | 49 | $encoding = $this->options['encoding']; |
50 | 50 | $xml = "<?xml version=\"1.0\" encoding=\"{$encoding}\"?>"; |
51 | - $data = $xml . $data; |
|
51 | + $data = $xml.$data; |
|
52 | 52 | } |
53 | 53 | return $data; |
54 | 54 | } |