Passed
Push — master ( f081ea...af57fd )
by 世昌
04:00
created
nebula/src/component/debug/attach/AttachTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
      *
12 12
      * @var array
13 13
      */
14
-    protected $attribute=[];
14
+    protected $attribute = [];
15 15
     
16
-    public function addAttribute(string $name , $value)
16
+    public function addAttribute(string $name, $value)
17 17
     {
18 18
         $this->attribute[$name] = $value;
19 19
     }
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
     protected function analyse(array $context)
22 22
     {
23 23
         $replace = [];
24
-        $attach  =[] ;
24
+        $attach  = [];
25 25
         foreach ($context as $key => $val) {
26
-            if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString')) && ! $val instanceof \Exception) {
27
-                $replace['{' . $key . '}'] = $val;
26
+            if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString')) && !$val instanceof \Exception) {
27
+                $replace['{'.$key.'}'] = $val;
28 28
             } else {
29 29
                 $attach[$key] = $val;
30 30
             }
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 
35 35
     public function interpolate(string $message, array $context, array $attribute)
36 36
     {
37
-        list($attach, $replace) =  $this->analyse($context);
37
+        list($attach, $replace) = $this->analyse($context);
38 38
         $attribute = array_merge($this->attribute, $attribute);
39 39
         foreach ($attribute as $key => $val) {
40
-            $replace['%' . $key . '%'] = $val;
40
+            $replace['%'.$key.'%'] = $val;
41 41
         }
42 42
         $message = strtr($message, $replace);
43 43
         $attachInfo = '';
44 44
         foreach ($attach as $name => $value) {
45 45
             $attachInfo = $name.' = ';
46 46
             if ($value instanceof AttachValueInterface) {
47
-                $attachInfo.= $value->getLogAttach().PHP_EOL;
47
+                $attachInfo .= $value->getLogAttach().PHP_EOL;
48 48
             } else {
49
-                $attachInfo.= DumpTrait::parameterToString($value).PHP_EOL;
49
+                $attachInfo .= DumpTrait::parameterToString($value).PHP_EOL;
50 50
             }
51 51
         }
52 52
         if (strlen($attachInfo) > 0) {
Please login to merge, or discard this patch.
nebula/src/NebulaApplication.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
         }
96 96
         if (!$this->config->has('app.import')) {
97 97
             $this->config->set('app.import', [
98
-                0 => \constant('NEBULA_APP').'/' .'share',
98
+                0 => \constant('NEBULA_APP').'/'.'share',
99 99
             ]);
100 100
         }
101 101
         if (!$this->config->has('app.resource')) {
102 102
             $this->config->set('app.resource', [
103
-                0 => \constant('NEBULA_APP').'/' .'resource',
103
+                0 => \constant('NEBULA_APP').'/'.'resource',
104 104
             ]);
105 105
         }
106 106
         if (!$this->config->has('app.module.scan-path')) {
107 107
             $this->config->set('app.module.scan-path', [
108
-                0 => \constant('NEBULA_APP').'/' .'modules',
108
+                0 => \constant('NEBULA_APP').'/'.'modules',
109 109
             ]);
110 110
         }
111 111
     }
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
         $logger = (new Runnable($this->getConfig()->get('app.logger-build', [$this, 'buildLogger'])))->run();
122 122
         $debugger = new Debugger;
123 123
         
124
-        $debugger->addAttribute('remote-ip' , $this->getRequest()->ip() );
125
-        $debugger->addAttribute('request-uri' , $this->getRequest()->getUrl());
126
-        $debugger->addAttribute('request-method' , $this->getRequest()->getMethod());
124
+        $debugger->addAttribute('remote-ip', $this->getRequest()->ip());
125
+        $debugger->addAttribute('request-uri', $this->getRequest()->getUrl());
126
+        $debugger->addAttribute('request-method', $this->getRequest()->getMethod());
127 127
 
128 128
         $debugger->applyConfig([
129 129
             'start-time' => \constant('NEBULA_START_TIME'),
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      */
190 190
     public function run()
191 191
     {
192
-        $className  = $this->config->get('app.application', Application::class);
192
+        $className = $this->config->get('app.application', Application::class);
193 193
         $this->application = Runnable::newClassInstance($className);
194 194
         $this->application->setContext($this);
195 195
         $this->application->setPath($this->path);
Please login to merge, or discard this patch.
nebula/src/application/Application.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -162,8 +162,8 @@
 block discarded – undo
162 162
      */
163 163
     protected function registerModuleManager()
164 164
     {
165
-       $this->manager = new Manager($this->getContext());
166
-       $this->manager->registerModule();
165
+        $this->manager = new Manager($this->getContext());
166
+        $this->manager->registerModule();
167 167
     }
168 168
 
169 169
     /**
Please login to merge, or discard this patch.
nebula/src/application/module/Module.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 
85 85
     public function getRoute(string $groupName): GroupRoutes
86 86
     {
87
-        $group = $groupName === 'default' ? '': '-'. $groupName;
88
-        $routeConfig = $this->getConfig('route'.$group, ['group' => $group,]);
89
-        $routes =  new GroupRoutes($groupName);
87
+        $group = $groupName === 'default' ? '' : '-'.$groupName;
88
+        $routeConfig = $this->getConfig('route'.$group, ['group' => $group, ]);
89
+        $routes = new GroupRoutes($groupName);
90 90
         if (\is_array($routeConfig)) {
91 91
             // debug()->debug('load route {group} from {module}',['group'=>$groupName, 'module' => $this->getFullName()]);
92 92
             $prefix = $this->config->get('route.prefix', '');
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function getFullName()
131 131
     {
132
-        return $this->name .':'. $this->version;
132
+        return $this->name.':'.$this->version;
133 133
     }
134 134
 
135 135
     /**
Please login to merge, or discard this patch.
nebula/src/application/module/Manager.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -148,8 +148,8 @@
 block discarded – undo
148 148
             $this->module[$module->getFullName()] = $module;
149 149
             $this->getContext()->getDebugger()->info('register module {name} at {path}', ['name'=>$module->getFullName(), 'path'=>$module->getPath()]);
150 150
         }
151
-       $this->buildLoadingOrder('alive', 'loadingOrder');
152
-       $this->buildLoadingOrder('reachable', 'routeLoadingOrder');
151
+        $this->buildLoadingOrder('alive', 'loadingOrder');
152
+        $this->buildLoadingOrder('reachable', 'routeLoadingOrder');
153 153
     }
154 154
     
155 155
     /**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     public function registerModule()
141 141
     {
142 142
         $scan = $this->getContext()->getConfig()->get('app.module.scan-path', []);
143
-        $cache = $this->getContext()->getApplication()->getDataPath() .'/module-cache';
143
+        $cache = $this->getContext()->getApplication()->getDataPath().'/module-cache';
144 144
         FileSystem::makes($cache);
145 145
         // 扫描加载
146 146
         foreach (Builder::scan($scan, $cache) as $module) {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      * @param string $name
191 191
      * @return Module|null
192 192
      */
193
-    public function find(string $name):?Module
193
+    public function find(string $name): ?Module
194 194
     {
195 195
         $fullName = $this->finder->getFullName($name);
196 196
         return $this->module[$fullName] ?? null;
Please login to merge, or discard this patch.
nebula/src/application/Route.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     public function loadFromModule(Manager $manager) {
50 50
         $groups =  $this->applicaton->getConfig()->get('app.active',['default']);
51 51
         foreach ($groups as $group) {
52
-           $manager->loadRoute($group, $this);
52
+            $manager->loadRoute($group, $this);
53 53
         }
54 54
     }
55 55
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @return void
48 48
      */
49 49
     public function loadFromModule(Manager $manager) {
50
-        $groups =  $this->applicaton->getConfig()->get('app.active',['default']);
50
+        $groups = $this->applicaton->getConfig()->get('app.active', ['default']);
51 51
         foreach ($groups as $group) {
52 52
            $manager->loadRoute($group, $this);
53 53
         }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function addGroupRoute(string $group, GroupRoutes $route) {
64 64
         if (\array_key_exists($group, $this->routes)) {
65 65
             $this->routes[$group]->merge($route);
66
-        }else{
66
+        } else {
67 67
             $this->routes[$group] = $route;
68 68
         }
69 69
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     public function addGroupRoute(string $group, GroupRoutes $route) {
64 64
         if (\array_key_exists($group, $this->routes)) {
65 65
             $this->routes[$group]->merge($route);
66
-        }else{
66
+        } else{
67 67
             $this->routes[$group] = $route;
68 68
         }
69 69
     }
Please login to merge, or discard this patch.
nebula/loader/web.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,15 +3,15 @@
 block discarded – undo
3 3
 use nebula\NebulaApplication;
4 4
 use nebula\application\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');
14
-$loader->import(NEBULA_SYSTEM .'/src/functions.php');
13
+$loader->addIncludePath(NEBULA_SYSTEM.'/src', 'nebula');
14
+$loader->import(NEBULA_SYSTEM.'/src/functions.php');
15 15
 // 初始化请求
16 16
 $request = Request::buildFromServer();
17 17
 $request->apply(true);
Please login to merge, or discard this patch.