Passed
Push — dev ( 6b4bd1...b901d7 )
by 世昌
02:22
created
suda/src/database/statement/PrepareTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             $fields = $reads;
26 26
         } else {
27 27
             $field = [];
28
-            $prefix = strlen($table) ?"`{$table}`." :'';
28
+            $prefix = strlen($table) ? "`{$table}`." : '';
29 29
             foreach ($reads as $want) {
30 30
                 $field[] = $prefix."`$want`";
31 31
             }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         foreach ($where as $name => $value) {
49 49
             $query = $this->getQueryForArray($name, $value);
50 50
             $and[] = $query->getQuery();
51
-            $binders  = array_merge($binders, $query->getBinder());
51
+            $binders = array_merge($binders, $query->getBinder());
52 52
         }
53 53
         return [implode(' AND ', $and), $binders];
54 54
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     protected function prepareQueryMark(string $sql, array $parameter)
198 198
     {
199 199
         $binders = [];
200
-        $query = preg_replace_callback('/\?/', function ($match) use (&$binders, $parameter) {
200
+        $query = preg_replace_callback('/\?/', function($match) use (&$binders, $parameter) {
201 201
             $index = count($binders);
202 202
             if (array_key_exists($index, $parameter)) {
203 203
                 $name = Binder::index($index);
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     protected function mergeBinder(array $binderArray, array $parameter)
227 227
     {
228 228
         foreach ($parameter as $key => $value) {
229
-            if (! ($value instanceof Binder)) {
229
+            if (!($value instanceof Binder)) {
230 230
                 $value = new Binder($key, $value);
231 231
             }
232 232
             if (!in_array($value, $binderArray)) {
Please login to merge, or discard this patch.
suda/src/framework/session/PHPSession.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
     public function get(string $name = null, $default = null)
111 111
     {
112 112
         if ($name !== null) {
113
-            return $this->has($name) ?$_SESSION[$name]:$default;
113
+            return $this->has($name) ? $_SESSION[$name] : $default;
114 114
         } else {
115 115
             return $_SESSION;
116 116
         }
Please login to merge, or discard this patch.
suda/src/framework/debug/attach/DumpInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
  */
9 9
 interface DumpInterface
10 10
 {
11
-    public static function parameterToString($object, int $deep=2);
11
+    public static function parameterToString($object, int $deep = 2);
12 12
     public static function dumpThrowable(Throwable $e);
13
-    public static function dumpTrace(array $backtrace, bool $str=true, string $perfix='');
13
+    public static function dumpTrace(array $backtrace, bool $str = true, string $perfix = '');
14 14
 }
Please login to merge, or discard this patch.
suda/src/database/middleware/ObjectMiddleware.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     {
58 58
         if (array_key_exists($name, $this->processor)) {
59 59
             if ($this->processor[$name] === ObjectMiddleware::SERIALIZE) {
60
-                return $data === null? $data : serialize($data);
60
+                return $data === null ? $data : serialize($data);
61 61
             }
62 62
             if ($this->processor[$name] === ObjectMiddleware::JSON) {
63 63
                 return json_encode($data);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         if ($doc = $property->getDocComment()) {
114 114
             if (is_string($doc) && preg_match('/@var\s+(\w+)/i', $doc, $match)) {
115 115
                 $type = strtolower($match[1]);
116
-                if (in_array($type, ['boolean', 'bool', 'integer', 'int' , 'float' , 'double', 'string'])) {
116
+                if (in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string'])) {
117 117
                     return ObjectMiddleware::RAW;
118 118
                 }
119 119
             }
Please login to merge, or discard this patch.
suda/src/application/loader/ModuleLoader.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $this->loadVendorIfExist();
26 26
         $this->loadShareLibrary();
27
-        $this->application->debug()->debug('loaded - ' . $this->module->getFullName());
27
+        $this->application->debug()->debug('loaded - '.$this->module->getFullName());
28 28
     }
29 29
 
30 30
     /**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     public function toActive()
36 36
     {
37 37
         $this->loadConfig();
38
-        $this->application->debug()->debug('active = ' . $this->module->getFullName());
38
+        $this->application->debug()->debug('active = '.$this->module->getFullName());
39 39
     }
40 40
 
41 41
     /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public function toReachable()
46 46
     {
47 47
         $this->loadRoute();
48
-        $this->application->debug()->debug('reachable # ' . $this->module->getFullName());
48
+        $this->application->debug()->debug('reachable # '.$this->module->getFullName());
49 49
     }
50 50
 
51 51
     /**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $this->checkRequirements();
57 57
         $this->loadPrivateLibrary();
58 58
         $this->application->setRunning($this->module);
59
-        $this->application->debug()->debug('run + ' . $this->module->getFullName());
59
+        $this->application->debug()->debug('run + '.$this->module->getFullName());
60 60
     }
61 61
 
62 62
     /**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function loadVendorIfExist()
105 105
     {
106
-        $vendorAutoload = $this->module->getPath() . '/vendor/autoload.php';
106
+        $vendorAutoload = $this->module->getPath().'/vendor/autoload.php';
107 107
         if (FileSystem::exist($vendorAutoload)) {
108 108
             Loader::requireOnce($vendorAutoload);
109 109
         }
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
      */
176 176
     protected function loadRouteGroup(string $groupName)
177 177
     {
178
-        $group = $groupName === 'default' ? '' : '-' . $groupName;
179
-        if ($path = $this->module->getResource()->getConfigResourcePath('config/route' . $group)) {
178
+        $group = $groupName === 'default' ? '' : '-'.$groupName;
179
+        if ($path = $this->module->getResource()->getConfigResourcePath('config/route'.$group)) {
180 180
             $routeConfig = Config::loadConfig($path, [
181 181
                 'module' => $this->module->getName(),
182 182
                 'group' => $groupName,
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 'config' => $this->module->getConfig(),
185 185
             ]);
186 186
             if ($routeConfig !== null) {
187
-                $prefix = $this->module->getConfig('route-prefix.' . $groupName, '');
187
+                $prefix = $this->module->getConfig('route-prefix.'.$groupName, '');
188 188
                 $this->loadRouteConfig($prefix, $groupName, $routeConfig);
189 189
             }
190 190
         }
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
             $uri = $config['uri'] ?? '/';
213 213
             $anti = array_key_exists('anti-prefix', $config) && $config['anti-prefix'];
214 214
             if ($anti) {
215
-                $uri = '/' . trim($uri, '/');
215
+                $uri = '/'.trim($uri, '/');
216 216
             } else {
217
-                $uri = '/' . trim($prefix . $uri, '/');
217
+                $uri = '/'.trim($prefix.$uri, '/');
218 218
             }
219 219
             $this->application->request($method, $exname, $uri, $attributes);
220 220
         }
Please login to merge, or discard this patch.
suda/src/application/database/Database.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
      */
73 73
     public static function getDataSourceFrom(ApplicationResource $resource, string $groupName)
74 74
     {
75
-        $group = $groupName === 'default' ? '': '-'. $groupName;
75
+        $group = $groupName === 'default' ? '' : '-'.$groupName;
76 76
         $dataSourceConfigPath = $resource->getConfigResourcePath('config/data-source'.$group);
77 77
         $dataSource = new DataSource;
78 78
         if ($dataSourceConfigPath !== null) {
Please login to merge, or discard this patch.
suda/src/application/Resource.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $path = $source;
42 42
         if (Path::isRelativePath($source)) {
43
-            $path = $relative . '/' . $path;
43
+            $path = $relative.'/'.$path;
44 44
         }
45 45
         return Path::toAbsolutePath($path);
46 46
     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         foreach ($this->resource as $root) {
97 97
             if ($pathInfo = $this->getTarget($root, $path)) {
98 98
                 list($root, $target) = $pathInfo;
99
-                $templateLimitPath = $limitPath ? $root . '/' . $limitPath : $root;
99
+                $templateLimitPath = $limitPath ? $root.'/'.$limitPath : $root;
100 100
                 if (FileSystem::exist($target)
101 101
                     && FileSystem::isOverflowPath($templateLimitPath, $target) === false) {
102 102
                     return $target;
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
     private function getTarget($root, string $path)
116 116
     {
117 117
         if (is_string($root)) {
118
-            return [$root, $root . '/' . $path];
118
+            return [$root, $root.'/'.$path];
119 119
         }
120 120
         list($prefix, $root) = $root;
121 121
         if (strpos($path, $prefix) === 0) {
122
-            return [$root, $root . '/' . ltrim(substr($path, strlen($prefix)), '/')];
122
+            return [$root, $root.'/'.ltrim(substr($path, strlen($prefix)), '/')];
123 123
         }
124 124
         return null;
125 125
     }
Please login to merge, or discard this patch.
suda/src/application/template/ModuleTemplateCommand.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
     protected function parseStatic($content)
29 29
     {
30
-        $content = strlen(trim($content)) === 0 ?'()':$content;
30
+        $content = strlen(trim($content)) === 0 ? '()' : $content;
31 31
         return '<?php echo $this->getStaticModulePrefix'.$content.'; ?>';
32 32
     }
33 33
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     protected function parseE($content)
39 39
     {
40
-        $content = strlen(trim($content)) === 0 ?'()':$content;
40
+        $content = strlen(trim($content)) === 0 ? '()' : $content;
41 41
         return '<?php echo $this->application->_'.$content.'; ?>';
42 42
     }
43 43
 }
Please login to merge, or discard this patch.
suda/src/application/template/compiler/Compiler.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @var Tag[]
28 28
      */
29
-    protected $tags=[];
29
+    protected $tags = [];
30 30
 
31 31
     /**
32 32
      * 命令对象
33 33
      *
34 34
      * @var CommandInterface[]
35 35
      */
36
-    protected $commands=[];
36
+    protected $commands = [];
37 37
 
38 38
     /**
39 39
      * 初始化
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function registerTag(Tag $tag)
83 83
     {
84
-        $this->tags[$tag->getName()] =$tag;
84
+        $this->tags[$tag->getName()] = $tag;
85 85
     }
86 86
 
87 87
     /**
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
     public function compileText(string $text, array $tagConfig = []):string
96 96
     {
97 97
         $this->applyTagConfig($tagConfig);
98
-        $result  = '';
98
+        $result = '';
99 99
         foreach (token_get_all($text) as $token) {
100 100
             if (is_array($token)) {
101 101
                 list($tag, $content) = $token;
102 102
                 // 所有将要编译的文本
103 103
                 // 跳过各种的PHP
104 104
                 if ($tag == T_INLINE_HTML) {
105
-                    $content=$this->processTags($content);
106
-                    $content=$this->processCommands($content);
105
+                    $content = $this->processTags($content);
106
+                    $content = $this->processCommands($content);
107 107
                 }
108 108
                 $result .= $content;
109 109
             } else {
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     {
140 140
         foreach ($this->tags as $tag) {
141 141
             $pregExp = sprintf('/(!)?%s\s*(.+?)\s*%s/', preg_quote($tag->getOpen()), preg_quote($tag->getClose()));
142
-            $text = preg_replace_callback($pregExp, function ($match) use ($tag) {
142
+            $text = preg_replace_callback($pregExp, function($match) use ($tag) {
143 143
                 if ($match[1] === '!') {
144 144
                     return substr($match[0], 1);
145 145
                 } else {
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
      */
158 158
     protected function processCommands(string $text):string
159 159
     {
160
-        $pregExp ='/\B\@(\!)?([\w\x{4e00}-\x{9aff}]+)(\s*)(\( ( (?>[^()]+) | (?4) )* \) )? /ux';
161
-        $code = preg_replace_callback($pregExp, [$this,'doMatchCommand'], $text);
160
+        $pregExp = '/\B\@(\!)?([\w\x{4e00}-\x{9aff}]+)(\s*)(\( ( (?>[^()]+) | (?4) )* \) )? /ux';
161
+        $code = preg_replace_callback($pregExp, [$this, 'doMatchCommand'], $text);
162 162
         $error = preg_last_error();
163 163
         if ($error !== PREG_NO_ERROR) {
164 164
             throw new Exception($error);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             list($input, $ignore, $name, $space) = $match;
175 175
             $params = '';
176 176
         }
177
-        if ($ignore ==='!') {
177
+        if ($ignore === '!') {
178 178
             return str_replace('@!', '@', $input);
179 179
         } else {
180 180
             foreach ($this->commands as $command) {
Please login to merge, or discard this patch.