Passed
Push — master ( 27f7d7...60bb46 )
by 世昌
02:14
created
suda/src/application/loader/ModuleLoader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     protected function loadRouteGroup(string $groupName)
205 205
     {
206
-        $group = $groupName === 'default' ? '': '-'. $groupName;
206
+        $group = $groupName === 'default' ? '' : '-'.$groupName;
207 207
         if ($path = $this->module->getResource()->getConfigResourcePath('config/route'.$group)) {
208 208
             $routeConfig = Config::loadConfig($path, [
209 209
                 'module' => $this->module->getName(),
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      */
230 230
     protected function loadRouteConfig(string $prefix, string $groupName, array $routeConfig)
231 231
     {
232
-        $module =  $this->module->getFullName();
232
+        $module = $this->module->getFullName();
233 233
         foreach ($routeConfig as $name => $config) {
234 234
             $exname = $this->application->getRouteName($name, $module, $groupName);
235 235
             $method = $config['method'] ?? [];
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             if ($anti) {
244 244
                 $uri = '/'.trim($uri, '/');
245 245
             } else {
246
-                $uri = '/'.trim($prefix . $uri, '/');
246
+                $uri = '/'.trim($prefix.$uri, '/');
247 247
             }
248 248
             $this->application->request($method, $exname, $uri, $attributes);
249 249
         }
Please login to merge, or discard this patch.
suda/src/application/Module.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getFullName(): string
111 111
     {
112
-        return $this->getName() . ':' . $this->getVersion();
112
+        return $this->getName().':'.$this->getVersion();
113 113
     }
114 114
 
115 115
     /**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function getUriSafeName(): string
121 121
     {
122
-        return $this->getName() . '/' . $this->getVersion();
122
+        return $this->getName().'/'.$this->getVersion();
123 123
     }
124 124
 
125 125
     /**
Please login to merge, or discard this patch.
suda/src/framework/debug/Debug.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     {
67 67
         $replace = [];
68 68
         foreach ($context as $key => $val) {
69
-            $replace['{' . $key . '}'] = $val;
69
+            $replace['{'.$key.'}'] = $val;
70 70
         }
71 71
         return strtr($message, $replace);
72 72
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
90 90
         $pos = min($pow, count($human) - 1);
91 91
         $bytes /= (1 << (10 * $pos));
92
-        return round($bytes, $precision) . ' ' . $human[$pos];
92
+        return round($bytes, $precision).' '.$human[$pos];
93 93
     }
94 94
 
95 95
     public function time(string $name, string $type = LogLevel::INFO)
Please login to merge, or discard this patch.
suda/src/application/Application.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
         $this->debug->info('===============================');
43 43
         $this->debug->time('loading application');
44 44
         $appLoader->load();
45
-        $this->event->exec('application:load-config', [ $this->config ,$this]);
45
+        $this->event->exec('application:load-config', [$this->config, $this]);
46 46
         $this->debug->timeEnd('loading application');
47 47
         $this->debug->time('loading data-source');
48 48
         $appLoader->loadDataSource();
49 49
         $this->debug->timeEnd('loading data-source');
50 50
         Table::load($this);
51 51
         DataAccess::load($this);
52
-        $this->event->exec('application:load-environment', [ $this->config ,$this]);
52
+        $this->event->exec('application:load-environment', [$this->config, $this]);
53 53
         $this->debug->time('loading route');
54 54
         $appLoader->loadRoute();
55
-        $this->event->exec('application:load-route', [$this->route , $this]);
55
+        $this->event->exec('application:load-route', [$this->route, $this]);
56 56
         $this->debug->timeEnd('loading route');
57 57
         $this->debug->info('-------------------------------');
58 58
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             if (!$response->isSend()) {
110 110
                 $response->end();
111 111
             }
112
-            $this->debug->info('responded with code '. $response->getStatus());
112
+            $this->debug->info('responded with code '.$response->getStatus());
113 113
             $this->debug->timeEnd('sending response');
114 114
         } catch (Throwable $e) {
115 115
             $this->debug->uncaughtException($e);
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     protected function createResponse(?MatchResult $result, Request $request, Response $response)
178 178
     {
179 179
         if (SUDA_DEBUG) {
180
-            $response->setHeader('x-route', $result === null?'default':$result->getName());
180
+            $response->setHeader('x-route', $result === null ? 'default' : $result->getName());
181 181
         }
182 182
         if ($result === null) {
183 183
             $content = $this->defaultResponse($this, $request, $response);
Please login to merge, or discard this patch.
suda/src/application/loader/ApplicationLoader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         foreach ($this->application->getModules() as $name => $module) {
54 54
             if ($module->getStatus() === Module::REACHABLE) {
55
-                call_user_func([$this->moduleLoader[$name],'toReachable']);
55
+                call_user_func([$this->moduleLoader[$name], 'toReachable']);
56 56
             }
57 57
         }
58 58
     }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function getDataSourceGroup(string $groupName):DataSource
95 95
     {
96
-        $group = $groupName === 'default' ? '': '-'. $groupName;
96
+        $group = $groupName === 'default' ? '' : '-'.$groupName;
97 97
         $dataSourceConfigPath = $this->application->getResource()->getConfigResourcePath('config/data-source'.$group);
98 98
         $dataSource = new DataSource;
99 99
         $observer = new DebugObserver($this->application->debug());
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
     protected function registerModule()
163 163
     {
164
-        $extractPath = SUDA_DATA .'/extract-module';
164
+        $extractPath = SUDA_DATA.'/extract-module';
165 165
         FileSystem::make($extractPath);
166 166
         foreach ($this->application->getModulePaths() as $path) {
167 167
             $this->registerModuleFrom($path, $extractPath);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         }
188 188
         $config = $config ?? [];
189 189
         $moduleNames = array_keys($modules->all());
190
-        $load  = $config['load'] ?? $moduleNames;
190
+        $load = $config['load'] ?? $moduleNames;
191 191
         $this->loadModules($modules, $load);
192 192
         $active = $config['active'] ?? $load;
193 193
         $this->setModuleActive($modules, $active);
Please login to merge, or discard this patch.
suda/src/application/template/ExceptionTemplate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@
 block discarded – undo
14 14
     public function __construct(Throwable $exception)
15 15
     {
16 16
         parent::__construct('', []);
17
-        $this->path = SUDA_RESOURCE. '/error.php';
17
+        $this->path = SUDA_RESOURCE.'/error.php';
18 18
         $type = get_class($exception);
19 19
         $this->value = [
20
-            'error_type' => $type ,
20
+            'error_type' => $type,
21 21
             'error_sort_type' => strpos($type, '\\') === false ? $type : substr($type, strrpos($type, '\\') + 1),
22 22
             'error_code' => $exception->getCode(),
23 23
             'error_message' => $exception->getMessage(),
Please login to merge, or discard this patch.
suda/src/application/template/CompilableTemplate.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
     protected function getStaticOutpath()
112 112
     {
113
-        $path = $this->config['assets-public'] ?? constant('SUDA_PUBLIC') . '/assets/' . $this->getStaticName();
113
+        $path = $this->config['assets-public'] ?? constant('SUDA_PUBLIC').'/assets/'.$this->getStaticName();
114 114
         FileSystem::make($path);
115 115
         return $path;
116 116
     }
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function getPath()
124 124
     {
125
-        $output = $this->config['output'] ?? constant('SUDA_DATA') . '/template';
125
+        $output = $this->config['output'] ?? constant('SUDA_DATA').'/template';
126 126
         FileSystem::make($output);
127
-        return $output . '/' . $this->name . '-' . substr(md5_file($this->getSourcePath()), 10, 8) . '.php';
127
+        return $output.'/'.$this->name.'-'.substr(md5_file($this->getSourcePath()), 10, 8).'.php';
128 128
     }
129 129
 
130 130
     /**
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     public function include(string $path)
227 227
     {
228 228
         $subfix = $this->config['subfix'] ?? '';
229
-        $included = new self(Resource::getPathByRelativePath($path . $subfix, dirname($this->source)), $this->config);
229
+        $included = new self(Resource::getPathByRelativePath($path.$subfix, dirname($this->source)), $this->config);
230 230
         $included->parent = $this;
231 231
         echo $included->getRenderedString();
232 232
     }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         } else {
250 250
             $prefix = '/assets';
251 251
         }
252
-        return $prefix . '/' . $this->getStaticName();
252
+        return $prefix.'/'.$this->getStaticName();
253 253
     }
254 254
 
255 255
     protected function prepareStaticSource()
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                 }
289 289
             }
290 290
         } catch (Exception $e) {
291
-            echo '<div style="color:red">' . $e->getMessage() . '</div>';
291
+            echo '<div style="color:red">'.$e->getMessage().'</div>';
292 292
             return;
293 293
         }
294 294
     }
Please login to merge, or discard this patch.
suda/src/application/template/ModuleTemplate.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     public function getSourcePath(): ?string
25 25
     {
26 26
         $subfix = $this->config['subfix'] ?? '.tpl.html';
27
-        return $this->getResource($this->module)->getResourcePath($this->getTemplatePath() . '/' . $this->name . $subfix);
27
+        return $this->getResource($this->module)->getResourcePath($this->getTemplatePath().'/'.$this->name.$subfix);
28 28
     }
29 29
 
30 30
     /**
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function getPath()
36 36
     {
37
-        $output = $this->config['output'] ?? $this->application->getDataPath() . '/template/' . $this->uriName;
37
+        $output = $this->config['output'] ?? $this->application->getDataPath().'/template/'.$this->uriName;
38 38
         FileSystem::make($output);
39
-        return $output . '/' . $this->name . '.php';
39
+        return $output.'/'.$this->name.'.php';
40 40
     }
41 41
 
42 42
     /**
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
 
57 57
     public function getRenderedString()
58 58
     {
59
-        $this->application->debug()->time('render ' . $this->name);
59
+        $this->application->debug()->time('render '.$this->name);
60 60
         $code = parent::getRenderedString();
61
-        $this->application->debug()->timeEnd('render ' . $this->name);
61
+        $this->application->debug()->timeEnd('render '.$this->name);
62 62
         return $code;
63 63
     }
64 64
 
65 65
     protected function compile()
66 66
     {
67 67
         if ($this->isCompiled() === false) {
68
-            $this->application->debug()->time('compile ' . $this->name);
68
+            $this->application->debug()->time('compile '.$this->name);
69 69
             $result = parent::compile();
70
-            $this->application->debug()->timeEnd('compile ' . $this->name);
70
+            $this->application->debug()->timeEnd('compile '.$this->name);
71 71
             return $result;
72 72
         }
73 73
         return true;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
                 $this->group
119 119
             );
120 120
         }
121
-        return '#' . $defaultName;
121
+        return '#'.$defaultName;
122 122
     }
123 123
 
124 124
     /**
Please login to merge, or discard this patch.