@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | // 添加 * ? 匹配 |
| 37 | 37 | $url = str_replace(['\*', '\?'], ['[^/]*?', '[^/]'], $url); |
| 38 | 38 | // 编译页面参数 |
| 39 | - $url = preg_replace_callback('/\{(\w+)(?:\:([^}]+?))?\}/', function ($match) use (&$parameters) { |
|
| 39 | + $url = preg_replace_callback('/\{(\w+)(?:\:([^}]+?))?\}/', function($match) use (&$parameters) { |
|
| 40 | 40 | $name = $match[1]; |
| 41 | 41 | $type = 'string'; |
| 42 | 42 | $extra = ''; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $url = static::parseIgnorableParameter($url, $matcher, $parameter, $mapper); |
| 71 | 71 | $url = static::replaceParameter($url, $matcher, $parameter, $mapper); |
| 72 | 72 | if (count($query) && $allowQuery) { |
| 73 | - return $url . '?' . http_build_query($query, 'v', '&', PHP_QUERY_RFC3986); |
|
| 73 | + return $url.'?'.http_build_query($query, 'v', '&', PHP_QUERY_RFC3986); |
|
| 74 | 74 | } |
| 75 | 75 | return $url; |
| 76 | 76 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | array $parameter, |
| 89 | 89 | array $mapper |
| 90 | 90 | ): string { |
| 91 | - return preg_replace_callback('/\[(.+?)\]/', function ($match) use ($matcher, $parameter, $mapper) { |
|
| 91 | + return preg_replace_callback('/\[(.+?)\]/', function($match) use ($matcher, $parameter, $mapper) { |
|
| 92 | 92 | if (preg_match('/\{(\w+).+?\}/', $match[1])) { |
| 93 | 93 | $count = 0; |
| 94 | 94 | $subUrl = static::replaceParameter($match[1], $matcher, $parameter, $mapper, true, $count); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | foreach ($parameter as $key => $value) { |
| 108 | 108 | if (is_numeric($key)) { |
| 109 | 109 | $mp = $matcher->getParameterByIndex($key); |
| 110 | - if ($mp !== null) { |
|
| 110 | + if ($mp !== null) { |
|
| 111 | 111 | unset($parameter[$key]); |
| 112 | 112 | $key = $mp->getIndexName(); |
| 113 | 113 | $parameter[$key] = $value; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ) { |
| 144 | 144 | return preg_replace_callback( |
| 145 | 145 | '/\{(\w+).+?\}/', |
| 146 | - function ($match) use ($matcher, $parameter, $mapper, $ignore, &$count) { |
|
| 146 | + function($match) use ($matcher, $parameter, $mapper, $ignore, &$count) { |
|
| 147 | 147 | if (array_key_exists($match[1], $mapper)) { |
| 148 | 148 | $count++; |
| 149 | 149 | return $mapper[$match[1]]->packValue($parameter[$match[1]]); |