@@ -73,7 +73,7 @@ |
||
| 73 | 73 | $val['domain'] = $ruleDomain; |
| 74 | 74 | |
| 75 | 75 | foreach (['method', 'rule', 'name', 'route', 'pattern', 'option'] as $param) { |
| 76 | - $call = 'get' . $param; |
|
| 76 | + $call = 'get'.$param; |
|
| 77 | 77 | $val[$param] = $item->$call(); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $module = $bindModule; |
| 47 | 47 | } |
| 48 | 48 | $available = true; |
| 49 | - } elseif (!in_array($module, $this->rule->getConfig('deny_module_list')) && is_dir($this->app->getAppPath() . $module)) { |
|
| 49 | + } elseif (!in_array($module, $this->rule->getConfig('deny_module_list')) && is_dir($this->app->getAppPath().$module)) { |
|
| 50 | 50 | $available = true; |
| 51 | 51 | } elseif ($this->rule->getConfig('empty_module')) { |
| 52 | 52 | $module = $this->rule->getConfig('empty_module'); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $this->request->setModule($module); |
| 60 | 60 | $this->app->init($module); |
| 61 | 61 | } else { |
| 62 | - throw new HttpException(404, 'module not exists:' . $module); |
|
| 62 | + throw new HttpException(404, 'module not exists:'.$module); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -93,12 +93,12 @@ discard block |
||
| 93 | 93 | $this->rule->getConfig('controller_suffix'), |
| 94 | 94 | $this->rule->getConfig('empty_controller')); |
| 95 | 95 | } catch (ClassNotFoundException $e) { |
| 96 | - throw new HttpException(404, 'controller not exists:' . $e->getClass()); |
|
| 96 | + throw new HttpException(404, 'controller not exists:'.$e->getClass()); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $this->app['middleware']->controller(function (Request $request, $next) use ($instance) { |
|
| 99 | + $this->app['middleware']->controller(function(Request $request, $next) use ($instance) { |
|
| 100 | 100 | // 获取当前操作名 |
| 101 | - $action = $this->actionName . $this->rule->getConfig('action_suffix'); |
|
| 101 | + $action = $this->actionName.$this->rule->getConfig('action_suffix'); |
|
| 102 | 102 | |
| 103 | 103 | if (is_callable([$instance, $action])) { |
| 104 | 104 | // 执行操作方法 |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $reflect = new ReflectionMethod($instance, '_empty'); |
| 124 | 124 | } else { |
| 125 | 125 | // 操作不存在 |
| 126 | - throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()'); |
|
| 126 | + throw new HttpException(404, 'method not exists:'.get_class($instance).'->'.$action.'()'); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $this->app['hook']->listen('action_begin', $call); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if (!empty($bind) && preg_match('/^[a-z]/is', $bind)) { |
| 43 | 43 | $bind = str_replace('/', $depr, $bind); |
| 44 | 44 | // 如果有模块/控制器绑定 |
| 45 | - $url = $bind . ('.' != substr($bind, -1) ? $depr : '') . ltrim($url, $depr); |
|
| 45 | + $url = $bind.('.' != substr($bind, -1) ? $depr : '').ltrim($url, $depr); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | list($path, $var) = $this->rule->parseUrlPath($url); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | if ($controller && !preg_match('/^[A-Za-z][\w|\.]*$/', $controller)) { |
| 64 | - throw new HttpException(404, 'controller not exists:' . $controller); |
|
| 64 | + throw new HttpException(404, 'controller not exists:'.$controller); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // 解析操作 |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | if ($this->rule->getConfig('url_param_type')) { |
| 73 | 73 | $var += $path; |
| 74 | 74 | } else { |
| 75 | - preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { |
|
| 75 | + preg_replace_callback('/(\w+)\|([^\|]+)/', function($match) use (&$var) { |
|
| 76 | 76 | $var[$match[1]] = strip_tags($match[2]); |
| 77 | 77 | }, implode('|', $path)); |
| 78 | 78 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $route = [$module, $controller, $action]; |
| 93 | 93 | |
| 94 | 94 | if ($this->hasDefinedRoute($route, $bind)) { |
| 95 | - throw new HttpException(404, 'invalid request:' . str_replace('|', $depr, $url)); |
|
| 95 | + throw new HttpException(404, 'invalid request:'.str_replace('|', $depr, $url)); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | return $route; |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | list($module, $controller, $action) = $route; |
| 111 | 111 | |
| 112 | 112 | // 检查地址是否被定义过路由 |
| 113 | - $name = strtolower($module . '/' . Loader::parseName($controller, 1) . '/' . $action); |
|
| 113 | + $name = strtolower($module.'/'.Loader::parseName($controller, 1).'/'.$action); |
|
| 114 | 114 | |
| 115 | 115 | $name2 = ''; |
| 116 | 116 | |
| 117 | 117 | if (empty($module) || $module == $bind) { |
| 118 | - $name2 = strtolower(Loader::parseName($controller, 1) . '/' . $action); |
|
| 118 | + $name2 = strtolower(Loader::parseName($controller, 1).'/'.$action); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $host = $this->request->host(true); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | protected function autoFindController($module, &$path) |
| 140 | 140 | { |
| 141 | - $dir = $this->app->getAppPath() . ($module ? $module . '/' : '') . $this->rule->getConfig('url_controller_layer'); |
|
| 141 | + $dir = $this->app->getAppPath().($module ? $module.'/' : '').$this->rule->getConfig('url_controller_layer'); |
|
| 142 | 142 | $suffix = $this->app->getSuffix() || $this->rule->getConfig('controller_suffix') ? ucfirst($this->rule->getConfig('url_controller_layer')) : ''; |
| 143 | 143 | |
| 144 | 144 | $item = []; |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | foreach ($path as $val) { |
| 148 | 148 | $item[] = $val; |
| 149 | - $file = $dir . '/' . str_replace('.', '/', $val) . $suffix . '.php'; |
|
| 150 | - $file = pathinfo($file, PATHINFO_DIRNAME) . '/' . Loader::parseName(pathinfo($file, PATHINFO_FILENAME), 1) . '.php'; |
|
| 149 | + $file = $dir.'/'.str_replace('.', '/', $val).$suffix.'.php'; |
|
| 150 | + $file = pathinfo($file, PATHINFO_DIRNAME).'/'.Loader::parseName(pathinfo($file, PATHINFO_FILENAME), 1).'.php'; |
|
| 151 | 151 | if (is_file($file)) { |
| 152 | 152 | $find = true; |
| 153 | 153 | break; |
| 154 | 154 | } else { |
| 155 | - $dir .= '/' . Loader::parseName($val); |
|
| 155 | + $dir .= '/'.Loader::parseName($val); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | { |
| 727 | 727 | if (is_string($route) && isset($option['prefix'])) { |
| 728 | 728 | // 路由地址前缀 |
| 729 | - $route = $option['prefix'] . $route; |
|
| 729 | + $route = $option['prefix'].$route; |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | // 替换路由地址中的变量 |
@@ -734,10 +734,10 @@ discard block |
||
| 734 | 734 | $search = $replace = []; |
| 735 | 735 | |
| 736 | 736 | foreach ($matches as $key => $value) { |
| 737 | - $search[] = '<' . $key . '>'; |
|
| 737 | + $search[] = '<'.$key.'>'; |
|
| 738 | 738 | $replace[] = $value; |
| 739 | 739 | |
| 740 | - $search[] = ':' . $key; |
|
| 740 | + $search[] = ':'.$key; |
|
| 741 | 741 | $replace[] = $value; |
| 742 | 742 | } |
| 743 | 743 | |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | if ($this->getConfig('use_action_prefix') && $this->router->getMethodPrefix($method)) { |
| 867 | 867 | $prefix = $this->router->getMethodPrefix($method); |
| 868 | 868 | // 操作方法前缀支持 |
| 869 | - $action = 0 !== strpos($action, $prefix) ? $prefix . $action : $action; |
|
| 869 | + $action = 0 !== strpos($action, $prefix) ? $prefix.$action : $action; |
|
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | // 设置当前请求的路由变量 |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | // AJAX PJAX 请求检查 |
| 896 | 896 | foreach (['ajax', 'pjax', 'mobile'] as $item) { |
| 897 | 897 | if (isset($option[$item])) { |
| 898 | - $call = 'is' . $item; |
|
| 898 | + $call = 'is'.$item; |
|
| 899 | 899 | if ($option[$item] && !$request->$call() || !$option[$item] && $request->$call()) { |
| 900 | 900 | return false; |
| 901 | 901 | } |
@@ -903,8 +903,8 @@ discard block |
||
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | // 伪静态后缀检测 |
| 906 | - if ($request->url() != '/' && ((isset($option['ext']) && false === stripos('|' . $option['ext'] . '|', '|' . $request->ext() . '|')) |
|
| 907 | - || (isset($option['deny_ext']) && false !== stripos('|' . $option['deny_ext'] . '|', '|' . $request->ext() . '|')))) { |
|
| 906 | + if ($request->url() != '/' && ((isset($option['ext']) && false === stripos('|'.$option['ext'].'|', '|'.$request->ext().'|')) |
|
| 907 | + || (isset($option['deny_ext']) && false !== stripos('|'.$option['deny_ext'].'|', '|'.$request->ext().'|')))) { |
|
| 908 | 908 | return false; |
| 909 | 909 | } |
| 910 | 910 | |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | if ($this->getConfig('url_param_type')) { |
| 945 | 945 | $var += explode('|', $url); |
| 946 | 946 | } else { |
| 947 | - preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { |
|
| 947 | + preg_replace_callback('/(\w+)\|([^\|]+)/', function($match) use (&$var) { |
|
| 948 | 948 | $var[$match[1]] = strip_tags($match[2]); |
| 949 | 949 | }, $url); |
| 950 | 950 | } |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | $regex .= '\/'; |
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | - return $regex . ($completeMatch ? '$' : ''); |
|
| 1020 | + return $regex.($completeMatch ? '$' : ''); |
|
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | 1023 | /** |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | $slash = substr($name, 0, 1); |
| 1035 | 1035 | |
| 1036 | 1036 | if (in_array($slash, ['/', '-'])) { |
| 1037 | - $prefix = '\\' . $slash; |
|
| 1037 | + $prefix = '\\'.$slash; |
|
| 1038 | 1038 | $name = substr($name, 1); |
| 1039 | 1039 | $slash = substr($name, 0, 1); |
| 1040 | 1040 | } else { |
@@ -1042,7 +1042,7 @@ discard block |
||
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | 1044 | if ('<' != $slash) { |
| 1045 | - return $prefix . preg_quote($name, '/'); |
|
| 1045 | + return $prefix.preg_quote($name, '/'); |
|
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | if (strpos($name, '?')) { |
@@ -1061,7 +1061,7 @@ discard block |
||
| 1061 | 1061 | $nameRule = $this->getConfig('default_route_pattern'); |
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | - return '(' . $prefix . '(?<' . $name . $suffix . '>' . $nameRule . '))' . $optional; |
|
| 1064 | + return '('.$prefix.'(?<'.$name.$suffix.'>'.$nameRule.'))'.$optional; |
|
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | 1067 | /** |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | // 指定Header数据 |
| 121 | 121 | if (!empty($option['header'])) { |
| 122 | 122 | $header = $option['header']; |
| 123 | - $this->app['hook']->add('response_send', function ($response) use ($header) { |
|
| 123 | + $this->app['hook']->add('response_send', function($response) use ($header) { |
|
| 124 | 124 | $response->header($header); |
| 125 | 125 | }); |
| 126 | 126 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $this->parseBindAppendParam($bind); |
| 120 | 120 | |
| 121 | 121 | // 记录绑定信息 |
| 122 | - Container::get('app')->log('[ BIND ] ' . var_export($bind, true)); |
|
| 122 | + Container::get('app')->log('[ BIND ] '.var_export($bind, true)); |
|
| 123 | 123 | |
| 124 | 124 | // 如果有URL绑定 则进行绑定检测 |
| 125 | 125 | $type = substr($bind, 0, 1); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $this->parseUrlParams($request, $array[2], $param); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - return new CallbackDispatch($request, $this, [$namespace . '\\' . Loader::parseName($class, 1), $method], $param); |
|
| 191 | + return new CallbackDispatch($request, $this, [$namespace.'\\'.Loader::parseName($class, 1), $method], $param); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $this->parseUrlParams($request, $array[1], $param); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - return new ControllerDispatch($request, $this, $controller . '/' . $action, $param); |
|
| 212 | + return new ControllerDispatch($request, $this, $controller.'/'.$action, $param); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $this->parseUrlParams($request, $array[1], $param); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - return new ModuleDispatch($request, $this, $controller . '/' . $action, $param); |
|
| 233 | + return new ModuleDispatch($request, $this, $controller.'/'.$action, $param); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | } |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | $multiselect = $this->multiselect; |
| 109 | 109 | $isAssoc = $this->isAssoc($choices); |
| 110 | 110 | |
| 111 | - return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { |
|
| 111 | + return function($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { |
|
| 112 | 112 | // Collapse all spaces. |
| 113 | 113 | $selectedChoices = str_replace(' ', '', $selected); |
| 114 | 114 | |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $default = $this->getDefault(); |
| 42 | 42 | $regex = $this->trueAnswerRegex; |
| 43 | 43 | |
| 44 | - return function ($answer) use ($default, $regex) { |
|
| 44 | + return function($answer) use ($default, $regex) { |
|
| 45 | 45 | if (is_bool($answer)) { |
| 46 | 46 | return $answer; |
| 47 | 47 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | proc_close($process); |
| 232 | 232 | |
| 233 | 233 | if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { |
| 234 | - return $matches[2] . 'x' . $matches[1]; |
|
| 234 | + return $matches[2].'x'.$matches[1]; |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | return; |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $lines = []; |
| 265 | 265 | $line = ''; |
| 266 | 266 | foreach (preg_split('//u', $utf8String) as $char) { |
| 267 | - if (mb_strwidth($line . $char, 'utf8') <= $width) { |
|
| 267 | + if (mb_strwidth($line.$char, 'utf8') <= $width) { |
|
| 268 | 268 | $line .= $char; |
| 269 | 269 | continue; |
| 270 | 270 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | if (null === $stream) { |
| 341 | 341 | $stream = $this->stdout; |
| 342 | 342 | } |
| 343 | - if (false === @fwrite($stream, $message . ($newline ? PHP_EOL : ''))) { |
|
| 343 | + if (false === @fwrite($stream, $message.($newline ? PHP_EOL : ''))) { |
|
| 344 | 344 | throw new \RuntimeException('Unable to write output.'); |
| 345 | 345 | } |
| 346 | 346 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | { |
| 357 | 357 | if (DIRECTORY_SEPARATOR === '\\') { |
| 358 | 358 | return |
| 359 | - '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD |
|
| 359 | + '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD |
|
| 360 | 360 | || false !== getenv('ANSICON') |
| 361 | 361 | || 'ON' === getenv('ConEmuANSI') |
| 362 | 362 | || 'xterm' === getenv('TERM'); |