@@ -26,18 +26,18 @@ |
||
26 | 26 | // 参数 |
27 | 27 | $parameters = []; |
28 | 28 | // 转义正则 |
29 | - $url=preg_replace('/([\/\.\\\\\+\(\^\)\$\!\<\>\-\?\*])/', '\\\\$1', $uri); |
|
29 | + $url = preg_replace('/([\/\.\\\\\+\(\^\)\$\!\<\>\-\?\*])/', '\\\\$1', $uri); |
|
30 | 30 | // 添加忽略 |
31 | - $url=preg_replace('/(\[)([^\[\]]+)(?(1)\])/', '(?:$2)?', $url); |
|
31 | + $url = preg_replace('/(\[)([^\[\]]+)(?(1)\])/', '(?:$2)?', $url); |
|
32 | 32 | // 添加 * ? 匹配 |
33 | - $url=str_replace(['\*','\?'],['[^/]+?','[^/]'], $url); |
|
33 | + $url = str_replace(['\*', '\?'], ['[^/]+?', '[^/]'], $url); |
|
34 | 34 | // 编译页面参数 |
35 | - $url=preg_replace_callback('/\{(\w+)(?:\:([^}]+?))?\}/', function ($match) use (&$parameters) { |
|
35 | + $url = preg_replace_callback('/\{(\w+)(?:\:([^}]+?))?\}/', function($match) use (&$parameters) { |
|
36 | 36 | $name = $match[1]; |
37 | 37 | $type = 'string'; |
38 | 38 | $extra = ''; |
39 | 39 | if (isset($match[2])) { |
40 | - if (strpos($match[2], '=')!==false) { |
|
40 | + if (strpos($match[2], '=') !== false) { |
|
41 | 41 | list($type, $extra) = \explode('=', $match[2]); |
42 | 42 | } else { |
43 | 43 | $type = $match[2]; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | /** |
5 | 5 | * 匹配参数 |
6 | 6 | */ |
7 | -abstract class Parameter { |
|
7 | +abstract class Parameter { |
|
8 | 8 | |
9 | 9 | protected static $name; |
10 | 10 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | public static function build(string $indexName, string $extra):Parameter { |
28 | - $parameter = new static($extra); |
|
28 | + $parameter = new static($extra); |
|
29 | 29 | $parameter->setIndexName($indexName); |
30 | 30 | return $parameter; |
31 | 31 | } |