Passed
Push — master ( 371408...02343f )
by 世昌
02:05
created
nebula/src/application/config/ConfigLoader.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  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 16
             $path = static::resolve($path);
17 17
         }
@@ -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  static function resolve(string $path):?string
64
+    public  static function resolve(string $path): ?string
65 65
     {
66 66
         if (file_exists($path)) {
67 67
             return $path;
68 68
         }
69 69
         $basepath = dirname($path).'/'.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/src/application/module/Builder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@
 block discarded – undo
42 42
             $extension !== 'module') {
43 43
             return null;
44 44
         }
45
-        $zip=new ZipArchive;
45
+        $zip = new ZipArchive;
46 46
         if ($zip->open($path, ZipArchive::CHECKCONS)) {
47
-            $unzipPath = $unpackPath.'/'. pathinfo($path, PATHINFO_FILENAME) .'-'.substr(md5_file($path), 0, 8);
47
+            $unzipPath = $unpackPath.'/'.pathinfo($path, PATHINFO_FILENAME).'-'.substr(md5_file($path), 0, 8);
48 48
             $zip->extractTo($unzipPath);
49 49
             $zip->close();
50 50
             return Config::resolve($unzipPath.'/module');
Please login to merge, or discard this patch.
nebula/src/application/route/GroupRoutes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function add(?string $module = null, string $name, RouteMatcher $router)
57 57
     {
58
-        $module =  $module ?: $this->default;
58
+        $module = $module ?: $this->default;
59 59
         if (\array_key_exists($module, $this->routes)) {
60 60
             $this->routes[$module]->add($name, $router);
61 61
         } else {
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
      * @param string $name
89 89
      * @return RouteMatcher|null
90 90
      */
91
-    public function find(?string $module = null, string $name):?RouteMatcher
91
+    public function find(?string $module = null, string $name): ?RouteMatcher
92 92
     {
93
-        $module =  $module ?: $this->default;
93
+        $module = $module ?: $this->default;
94 94
         if (\array_key_exists($module, $this->routes)) {
95 95
             return $this->routes[$module]->get($name);
96 96
         }
Please login to merge, or discard this patch.
nebula/src/NebulaApplication.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,17 +99,17 @@  discard block
 block discarded – undo
99 99
         }
100 100
         if (!$this->config->has('app.import')) {
101 101
             $this->config->set('app.import', [
102
-                0 => \constant('NEBULA_APP').'/' .'share',
102
+                0 => \constant('NEBULA_APP').'/'.'share',
103 103
             ]);
104 104
         }
105 105
         if (!$this->config->has('app.resource')) {
106 106
             $this->config->set('app.resource', [
107
-                0 => \constant('NEBULA_APP').'/' .'resource',
107
+                0 => \constant('NEBULA_APP').'/'.'resource',
108 108
             ]);
109 109
         }
110 110
         if (!$this->config->has('app.module.scan-path')) {
111 111
             $this->config->set('app.module.scan-path', [
112
-                0 => \constant('NEBULA_APP').'/' .'modules',
112
+                0 => \constant('NEBULA_APP').'/'.'modules',
113 113
             ]);
114 114
         }
115 115
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public function run()
188 188
     {
189
-        $className  = $this->config->get('app.application', Application::class);
189
+        $className = $this->config->get('app.application', Application::class);
190 190
         $this->application = Runnable::newClassInstance($className);
191 191
         $this->application->setContext($this);
192 192
         $this->application->setPath($this->path);
Please login to merge, or discard this patch.
nebula/src/application/module/Manager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     public function registerModule()
118 118
     {
119 119
         $scan = $this->getContext()->getConfig()->get('app.module.scan-path', []);
120
-        $cache = $this->getContext()->getDataPath() .'/module-cache';
120
+        $cache = $this->getContext()->getDataPath().'/module-cache';
121 121
         FileSystem::makes($cache);
122 122
         foreach (Builder::scan($scan, $cache) as $module) {
123 123
             $this->finder->add($module->getName(), $module->getVersion());
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      * @param string $name
134 134
      * @return Module|null
135 135
      */     
136
-    public function find(string $name):?Module {
136
+    public function find(string $name): ?Module {
137 137
         $fullName = $this->finder->getFullName($name);
138 138
         return $this->module[$fullName] ?? null;
139 139
     }
Please login to merge, or discard this patch.