Completed
Push — 6.0 ( 4053b1...1ddd94 )
by liu
10:02
created
src/think/route/RuleItem.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\route;
14 14
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         $rule = '/' != $rule ? ltrim($rule, '/') : '';
135 135
 
136 136
         if ($this->parent && $prefix = $this->parent->getFullName()) {
137
-            $rule = $prefix . ($rule ? '/' . ltrim($rule, '/') : '');
137
+            $rule = $prefix.($rule ? '/'.ltrim($rule, '/') : '');
138 138
         }
139 139
 
140 140
         if (false !== strpos($rule, ':')) {
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
         if (isset($option['ext'])) {
239 239
             // 路由ext参数 优先于系统配置的URL伪静态后缀参数
240
-            $url = preg_replace('/\.(' . $request->ext() . ')$/i', '', $url);
240
+            $url = preg_replace('/\.('.$request->ext().')$/i', '', $url);
241 241
         }
242 242
 
243 243
         return $url;
@@ -261,38 +261,38 @@  discard block
 block discarded – undo
261 261
         $pattern = array_merge($this->parent->getPattern(), $this->pattern);
262 262
 
263 263
         // 检查完整规则定义
264
-        if (isset($pattern['__url__']) && !preg_match(0 === strpos($pattern['__url__'], '/') ? $pattern['__url__'] : '/^' . $pattern['__url__'] . ($completeMatch ? '$' : '') . '/', str_replace('|', $depr, $url))) {
264
+        if (isset($pattern['__url__']) && !preg_match(0 === strpos($pattern['__url__'], '/') ? $pattern['__url__'] : '/^'.$pattern['__url__'].($completeMatch ? '$' : '').'/', str_replace('|', $depr, $url))) {
265 265
             return false;
266 266
         }
267 267
 
268 268
         $var  = [];
269
-        $url  = $depr . str_replace('|', $depr, $url);
270
-        $rule = $depr . str_replace('/', $depr, $this->rule);
269
+        $url  = $depr.str_replace('|', $depr, $url);
270
+        $rule = $depr.str_replace('/', $depr, $this->rule);
271 271
 
272 272
         if ($depr == $rule && $depr != $url) {
273 273
             return false;
274 274
         }
275 275
 
276 276
         if (false === strpos($rule, '<')) {
277
-            if (0 === strcasecmp($rule, $url) || (!$completeMatch && 0 === strncasecmp($rule . $depr, $url . $depr, strlen($rule . $depr)))) {
277
+            if (0 === strcasecmp($rule, $url) || (!$completeMatch && 0 === strncasecmp($rule.$depr, $url.$depr, strlen($rule.$depr)))) {
278 278
                 return $var;
279 279
             }
280 280
             return false;
281 281
         }
282 282
 
283
-        $slash = preg_quote('/-' . $depr, '/');
283
+        $slash = preg_quote('/-'.$depr, '/');
284 284
 
285
-        if ($matchRule = preg_split('/[' . $slash . ']?<\w+\??>/', $rule, 2)) {
285
+        if ($matchRule = preg_split('/['.$slash.']?<\w+\??>/', $rule, 2)) {
286 286
             if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) {
287 287
                 return false;
288 288
             }
289 289
         }
290 290
 
291
-        if (preg_match_all('/[' . $slash . ']?<?\w+\??>?/', $rule, $matches)) {
291
+        if (preg_match_all('/['.$slash.']?<?\w+\??>?/', $rule, $matches)) {
292 292
             $regex = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $completeMatch);
293 293
 
294 294
             try {
295
-                if (!preg_match('/^' . $regex . ($completeMatch ? '$' : '') . '/u', $url, $match)) {
295
+                if (!preg_match('/^'.$regex.($completeMatch ? '$' : '').'/u', $url, $match)) {
296 296
                     return false;
297 297
                 }
298 298
             } catch (\Exception $e) {
Please login to merge, or discard this patch.