Passed
Push — master ( 934657...c3ba90 )
by 世昌
02:07
created
public/dev.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use nebula\application\helper\FileHelper;
8 8
 use nebula\component\debug\log\logger\FileLogger;
9 9
 
10
-require_once __DIR__ .'/../vendor/autoload.php';
10
+require_once __DIR__.'/../vendor/autoload.php';
11 11
 
12 12
 $logger = new FileLogger(
13 13
     [
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
 $debug->timeEnd('Request::buildFromServer');
32 32
 
33 33
 $debug->debug('request apply true', [
34
-    'request' => $request ,
34
+    'request' => $request,
35 35
     'exception' => new Exception('test exception')
36 36
 ]);
37 37
 
38 38
 $debug->debug('request  getBasicURI {url}', ['url' => $request->getBasicURI()]);
39 39
 
40
-function formatBytes(int $bytes, int $precision=0)
40
+function formatBytes(int $bytes, int $precision = 0)
41 41
 {
42
-    $human= ['B', 'KB', 'MB', 'GB', 'TB'];
42
+    $human = ['B', 'KB', 'MB', 'GB', 'TB'];
43 43
     $bytes = max($bytes, 0);
44
-    $pow = floor(($bytes?log($bytes):0)/log(1024));
45
-    $pos = min($pow, count($human)-1);
46
-    $bytes /= (1 << (10* $pos));
44
+    $pow = floor(($bytes ?log($bytes) : 0) / log(1024));
45
+    $pos = min($pow, count($human) - 1);
46
+    $bytes /= (1 << (10 * $pos));
47 47
     return round($bytes, $precision).' '.$human[$pos];
48 48
 }
49 49
 
Please login to merge, or discard this patch.
nebula/src/component/route/RouteCollection.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @param RouteMatcher[] $collection
25 25
      */
26
-    public function __construct(array $collection=[])
26
+    public function __construct(array $collection = [])
27 27
     {
28 28
         $this->mergeArray($collection);
29 29
     }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * @param array $collection
35 35
      * @return void
36 36
      */
37
-    public function mergeArray(array $collection=[])
37
+    public function mergeArray(array $collection = [])
38 38
     {
39 39
         $this->collection = array_merge($this->collection, $collection);
40 40
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param string $name
69 69
      * @return RouteMatcher|null
70 70
      */
71
-    public function get(string $name):?RouteMatcher
71
+    public function get(string $name): ?RouteMatcher
72 72
     {
73 73
         return $this->collection[$name] ?? null;
74 74
     }
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->initialization();
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
@@ -146,8 +146,8 @@
 block discarded – undo
146 146
      */
147 147
     protected function registerModuleManager()
148 148
     {
149
-       $this->manager = new Manager($this->getContext());
150
-       $this->manager->registerModule();
149
+        $this->manager = new Manager($this->getContext());
150
+        $this->manager->registerModule();
151 151
     }
152 152
 
153 153
     
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
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function add(?string $module = null, string $name, RouteMatcher $router)
58 58
     {
59
-        $module =  $module ?: $this->default;
59
+        $module = $module ?: $this->default;
60 60
         if (\array_key_exists($module, $this->routes)) {
61 61
             $this->routes[$module]->add($name, $router);
62 62
         } else {
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
      * @param string|null $default
89 89
      * @return RouteMatcher|null
90 90
      */
91
-    public function find(?string $module = null, string $name, ?string $default = null):?RouteMatcher
91
+    public function find(?string $module = null, string $name, ?string $default = null): ?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/application/module/Module.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 
76 76
     public function getRoute(string $groupName): GroupRoutes
77 77
     {
78
-        $group = $groupName === 'default' ? '': '-'. $groupName;
79
-        $routeConfig = $this->getConfig('route'.$group, ['group' => $group,]);
80
-        $routes =  new GroupRoutes($groupName);
78
+        $group = $groupName === 'default' ? '' : '-'.$groupName;
79
+        $routeConfig = $this->getConfig('route'.$group, ['group' => $group, ]);
80
+        $routes = new GroupRoutes($groupName);
81 81
         if (\is_array($routeConfig)) {
82 82
             $prefix = $this->config->get('route.prefix', '');
83 83
             foreach ($routeConfig as $name => $value) {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      */
119 119
     public function getFullName()
120 120
     {
121
-        return $this->name .':'. $this->version;
121
+        return $this->name.':'.$this->version;
122 122
     }
123 123
 
124 124
     /**
Please login to merge, or discard this patch.
nebula/src/application/module/Builder.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
                         $extension === 'mod' ||
64 64
                         $extension === 'module') {
65 65
                         if ($configPath = static::checkPack($path, $extractPath)) {
66
-                           yield static::build($configPath);
66
+                            yield static::build($configPath);
67 67
                         }
68 68
                     }
69 69
                 } elseif (is_dir($path)) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@
 block discarded – undo
36 36
 
37 37
     public static function checkPack(string $path, string $unpackPath): ?string
38 38
     {
39
-        $zip=new ZipArchive;
39
+        $zip = new ZipArchive;
40 40
         if ($zip->open($inputFile, ZipArchive::CHECKCONS)) {
41
-            $unzipPath = $unpackPath.'/'. pathinfo($path, PATHINFO_FILENAME) .'-'.substr(md5_file($path), 0, 8);
41
+            $unzipPath = $unpackPath.'/'.pathinfo($path, PATHINFO_FILENAME).'-'.substr(md5_file($path), 0, 8);
42 42
             $zip->extractTo($unzipPath);
43 43
             $zip->close();
44 44
             return Config::resolve($unzipPath.'/module');
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
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     public function registerModule()
117 117
     {
118 118
         $scan = $this->getContext()->getConfig()->get('app.module.scan-path', []);
119
-        $cache = $this->getContext()->getDataPath() .'/module-cache';
119
+        $cache = $this->getContext()->getDataPath().'/module-cache';
120 120
         FileSystem::makes($cache);
121 121
         foreach (Builder::scan($scan, $cache) as $module) {
122 122
             $this->finder->add($module->getName(), $module->getVersion());
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      * @param string $name
142 142
      * @return Module|null
143 143
      */     
144
-    public function find(string $name):?Module {
144
+    public function find(string $name): ?Module {
145 145
         
146 146
     }
147 147
 }
Please login to merge, or discard this patch.
nebula/src/application/config/Config.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         $this->config = $config;
21 21
     }
22 22
 
23
-    public function load(string $path, array $extra =[])
23
+    public function load(string $path, array $extra = [])
24 24
     {
25 25
         $data = $this->loadConfig($path, $extra);
26 26
         if ($data) {
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 
36 36
     public function assign(array $config)
37 37
     {
38
-        return $this->config=array_merge($this->config, $config);
38
+        return $this->config = array_merge($this->config, $config);
39 39
     }
40 40
 
41
-    public function get(string $name=null, $default=null)
41
+    public function get(string $name = null, $default = null)
42 42
     {
43 43
         if (is_null($name)) {
44 44
             return $this->config;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         return ArrayDotAccess::get($this->config, $name, $default);
47 47
     }
48 48
 
49
-    public function set(string $name, $value, $combine=null)
49
+    public function set(string $name, $value, $combine = null)
50 50
     {
51 51
         return ArrayDotAccess::set($this->config, $name, $value, $combine);
52 52
     }
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
         return ArrayDotAccess::exist($this->config, $name);
57 57
     }
58 58
 
59
-    public function parseValue(string $content, array $extra =[]):string
59
+    public function parseValue(string $content, array $extra = []):string
60 60
     {
61
-        return preg_replace_callback('/\$\{(.+?)\}/', function ($matchs) use ($extra) {
61
+        return preg_replace_callback('/\$\{(.+?)\}/', function($matchs) use ($extra) {
62 62
             $name = $matchs[1];
63
-            if (($value = ArrayDotAccess::get($extra, $name, null))!==null) {
63
+            if (($value = ArrayDotAccess::get($extra, $name, null)) !== null) {
64 64
             } elseif (defined($name)) {
65 65
                 $value = constant($name);
66 66
             } else {
67 67
                 $value = $this->get($name, $matchs[0]);
68 68
             }
69
-            return is_string($value)?trim(json_encode($value), '"'):$value;
69
+            return is_string($value) ?trim(json_encode($value), '"') : $value;
70 70
         }, $content);
71 71
     }
72 72
 }
Please login to merge, or discard this patch.