Passed
Push — master ( 229425...f03095 )
by 世昌
01:53
created
nebula/src/component/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.
nebula/src/component/request/file/UploadedFile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 /**
8 8
  * HTTP请求文件
9 9
  */
10
-class UploadedFile  extends File  {
10
+class UploadedFile  extends File {
11 11
 
12 12
     private $originalName;
13 13
     private $mimeType;
Please login to merge, or discard this patch.
nebula/src/component/request/file/File.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 /**
6 6
  * HTTP请求文件
7 7
  */
8
-class File  extends \SplFileInfo  {
8
+class File  extends \SplFileInfo {
9 9
     /**
10 10
      * 创建文件
11 11
      *
Please login to merge, or discard this patch.
nebula/src/component/request/header/HeaderItem.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @var array
29 29
      */
30
-    protected static $headers =[
30
+    protected static $headers = [
31 31
         'content-type' => ContentTypeItem::class,
32 32
     ];
33 33
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             if ($value instanceof HeaderItem) {
70 70
                 $header = $value;
71 71
             } elseif (array_key_exists($name, static::$headers)) {
72
-                $class =static::$headers[$name];
72
+                $class = static::$headers[$name];
73 73
                 $header = new $class($name, $value);
74 74
             } else {
75 75
                 $header = new HeaderItem($name, $value);
Please login to merge, or discard this patch.
nebula/src/component/database/connector/Connector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
         if (is_null($this->pdo)) {
86 86
             try {
87 87
                 $this->pdo = new PDO($this->getDsn(), $this->config['database-user'], $this->config['database-password']);
88
-                static::$connetionCount ++;
88
+                static::$connetionCount++;
89 89
             } catch (PDOException $e) {
90 90
                 throw new ConnectionException($e->getMessage(), $e->getCode());
91 91
             }
Please login to merge, or discard this patch.
nebula/src/application/config/Config.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class Config extends ConfigLoader
11 11
 {
12
-    public $config=[];
12
+    public $config = [];
13 13
 
14
-    public function load(string $path, array $extra =[])
14
+    public function load(string $path, array $extra = [])
15 15
     {
16 16
         $data = $this->loadConfig($path, $extra);
17 17
         if ($data) {
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function assign(array $config)
28 28
     {
29
-        return $this->config=array_merge($this->config, $config);
29
+        return $this->config = array_merge($this->config, $config);
30 30
     }
31 31
 
32
-    public function get(string $name=null, $default=null)
32
+    public function get(string $name = null, $default = null)
33 33
     {
34 34
         if (is_null($name)) {
35 35
             return $this->config;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         return ArrayDotAccess::get($this->config, $name, $default);
38 38
     }
39 39
 
40
-    public function set(string $name, $value, $combine=null)
40
+    public function set(string $name, $value, $combine = null)
41 41
     {
42 42
         return ArrayDotAccess::set($this->config, $name, $value, $combine);
43 43
     }
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
         return ArrayDotAccess::exist($this->config, $name);
48 48
     }
49 49
 
50
-    public function parseValue(string $content, array $extra =[]):string
50
+    public function parseValue(string $content, array $extra = []):string
51 51
     {
52
-        return preg_replace_callback('/\$\{(.+?)\}/', function ($matchs) use ($extra) {
52
+        return preg_replace_callback('/\$\{(.+?)\}/', function($matchs) use ($extra) {
53 53
             $name = $matchs[1];
54
-            if (($value = ArrayDotAccess::get($extra, $name, null))!==null) {
54
+            if (($value = ArrayDotAccess::get($extra, $name, null)) !== null) {
55 55
             } elseif (defined($name)) {
56 56
                 $value = constant($name);
57 57
             } else {
58 58
                 $value = $this->get($name, $matchs[0]);
59 59
             }
60
-            return is_string($value)?trim(json_encode($value), '"'):$value;
60
+            return is_string($value) ?trim(json_encode($value), '"') : $value;
61 61
         }, $content);
62 62
     }
63 63
 }
Please login to merge, or discard this patch.
nebula/src/application/config/ConfigLoader.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  */
10 10
 abstract class ConfigLoader
11 11
 {
12
-    public function loadConfig(string $path, array $extra =[]):?array
12
+    public function loadConfig(string $path, array $extra = []): ?array
13 13
     {
14
-        $data=null;
14
+        $data = null;
15 15
         if (!file_exists($path)) {
16
-            $path =$this->resolve($path);
16
+            $path = $this->resolve($path);
17 17
         }
18 18
         if ($path) {
19 19
             $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
@@ -27,25 +27,25 @@  discard block
 block discarded – undo
27 27
         return $data;
28 28
     }
29 29
 
30
-    protected function loadJson(string $path, array $extra =[]):array
30
+    protected function loadJson(string $path, array $extra = []):array
31 31
     {
32 32
         $content = file_get_contents($path);
33
-        $content =$this->parseValue($content, $extra);
33
+        $content = $this->parseValue($content, $extra);
34 34
         $data = json_decode($content, true);
35
-        if (json_last_error()!==JSON_ERROR_NONE) {
35
+        if (json_last_error() !== JSON_ERROR_NONE) {
36 36
             throw new JSONException(json_last_error());
37 37
         }
38 38
         return $data;
39 39
     }
40 40
 
41
-    protected function loadIni(string $path, array $extra =[]):array
41
+    protected function loadIni(string $path, array $extra = []):array
42 42
     {
43 43
         $content = file_get_contents($path);
44
-        $content =$this->parseValue($content, $extra);
44
+        $content = $this->parseValue($content, $extra);
45 45
         return \parse_ini_string($content, true) ?: [];
46 46
     }
47 47
 
48
-    protected function loadYaml(string $path, array $extra =[]):array
48
+    protected function loadYaml(string $path, array $extra = []):array
49 49
     {
50 50
         if (function_exists('yaml_parse')) {
51 51
             $name = 'yaml_parse';
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
             throw new YamlException("parse yaml config error : missing yaml extension or spyc", 1);
56 56
         }
57 57
         $content = file_get_contents($path);
58
-        $content =$this->parseValue($content, $extra);
58
+        $content = $this->parseValue($content, $extra);
59 59
         return \call_user_func_array($name, [$content]);
60 60
     }
61 61
 
62
-    abstract public function parseValue(string $content, array $extra =[]):string;
62
+    abstract public function parseValue(string $content, array $extra = []):string;
63 63
 
64
-    public function resolve(string $path):?string
64
+    public function resolve(string $path): ?string
65 65
     {
66 66
         if (file_exists($path)) {
67 67
             return $path;
68 68
         }
69 69
         $basepath = pathinfo($path, PATHINFO_FILENAME);
70
-        if (file_exists($conf = $basepath.'.yml')  || file_exists($conf = $basepath.'.yaml')) {
70
+        if (file_exists($conf = $basepath.'.yml') || file_exists($conf = $basepath.'.yaml')) {
71 71
             if (function_exists('yaml_parse') || class_exists('Spyc')) {
72 72
                 return $conf;
73 73
             }
74 74
         }
75
-        foreach (['.json','.php','.ini'] as $ext) {
76
-            if (file_exists($conf=$basepath.$ext)) {
75
+        foreach (['.json', '.php', '.ini'] as $ext) {
76
+            if (file_exists($conf = $basepath.$ext)) {
77 77
                 return $conf;
78 78
             }
79 79
         }
Please login to merge, or discard this patch.
nebula/loader/loader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 
4 4
 defined('NEBULA_SYSTEM') or define('NEBULA_SYSTEM', dirname(__DIR__));
5 5
 
6
-require_once NEBULA_SYSTEM .'/src/component/loader/PathTrait.php';
7
-require_once NEBULA_SYSTEM .'/src/component/loader/PathInterface.php';
8
-require_once NEBULA_SYSTEM .'/src/component/loader/IncludeManager.php';
9
-require_once NEBULA_SYSTEM .'/src/component/loader/Loader.php';
6
+require_once NEBULA_SYSTEM.'/src/component/loader/PathTrait.php';
7
+require_once NEBULA_SYSTEM.'/src/component/loader/PathInterface.php';
8
+require_once NEBULA_SYSTEM.'/src/component/loader/IncludeManager.php';
9
+require_once NEBULA_SYSTEM.'/src/component/loader/Loader.php';
Please login to merge, or discard this patch.
nebula/loader/web.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@
 block discarded – undo
3 3
 use nebula\Application;
4 4
 use nebula\component\loader\Loader;
5 5
 
6
-require_once __DIR__ .'/loader.php';
6
+require_once __DIR__.'/loader.php';
7 7
 
8 8
 
9 9
 // 初始化系统加载器
10 10
 
11 11
 $loader = new Loader;
12 12
 $loader->register();
13
-$loader->addIncludePath(NEBULA_SYSTEM .'/src', 'nebula');
13
+$loader->addIncludePath(NEBULA_SYSTEM.'/src', 'nebula');
14 14
 
15 15
 // 初始化应用
16 16
 $app = new Application;
Please login to merge, or discard this patch.