Passed
Push — master ( b262da...c4f2e2 )
by 世昌
02:19
created
nebula/route/uri/MatchBuilder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,18 +26,18 @@
 block discarded – undo
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];
Please login to merge, or discard this patch.
nebula/route/uri/parameter/Parameter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
nebula/request/attribute/UriAttribute.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         } else {
153 153
             $indexFile = substr($this->getEntranceFile(), strlen($this->getDocumentRoot()));
154 154
         }
155
-        return $this->indexFile = str_replace('\\', '/' ,$indexFile);
155
+        return $this->indexFile = str_replace('\\', '/', $indexFile);
156 156
     }
157 157
 
158 158
     /**
@@ -165,26 +165,26 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $Url = $this->Uri;
167 167
 
168
-        $queryString='';
168
+        $queryString = '';
169 169
         // for /?/xx
170 170
         if (\strpos($Url, '/?/') === 0) {
171 171
             $Url = substr($Url, 2);
172 172
         }
173 173
         $indexFile = $this->getIndexFile();
174
-        if (\strpos($Url, $indexFile) ===0) {
174
+        if (\strpos($Url, $indexFile) === 0) {
175 175
             // for /index.php/
176
-            $Url = \substr($Url, strlen($indexFile));// for /index.php?/
176
+            $Url = \substr($Url, strlen($indexFile)); // for /index.php?/
177 177
             if (\strpos($Url, '?/') === 0) {
178 178
                 $Url = ltrim($Url, '?');
179 179
             }
180 180
             // for /index.php
181
-            elseif (\strpos($Url, '/')!== 0) {
181
+            elseif (\strpos($Url, '/') !== 0) {
182 182
                 $Url = '/'.$Url;
183 183
             }
184 184
         }
185 185
         $queryStart = \strpos($Url, '?');
186 186
         if ($queryStart !== false) {
187
-            $queryString = \substr($Url, $queryStart+1);
187
+            $queryString = \substr($Url, $queryStart + 1);
188 188
             $Url = \substr($Url, 0, $queryStart);
189 189
         }
190 190
         $this->Url = $Url;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             parse_str($queryString, $this->queryParameter);
193 193
         }
194 194
         if ($applyServer) {
195
-            $_SERVER['PATH_INFO'] =  $this->Url;
195
+            $_SERVER['PATH_INFO'] = $this->Url;
196 196
             $_SERVER['SCRIPT_NAME'] = $this->getIndexFile();
197 197
             $_SERVER['PHP_SELF'] = $this->getIndexFile();
198 198
             $_GET = $this->queryParameter;
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
         }
211 211
         $serverBasicUri = $this->getServerUri();
212 212
         $indexFile = $this->getIndexFile();
213
-        $isWindows = DIRECTORY_SEPARATOR ===  '\\';
214
-        $isRoot= in_array(substr($indexFile, 1), static::getDefaultIndexs());
213
+        $isWindows = DIRECTORY_SEPARATOR === '\\';
214
+        $isRoot = in_array(substr($indexFile, 1), static::getDefaultIndexs());
215 215
         if ($this->enabledRewrite && $isRoot) {
216 216
             if ($isWindows && !$this->enabledBeautifyUrl) {
217 217
                 return $this->basicUri = $serverBasicUri.'/?/';
Please login to merge, or discard this patch.