Passed
Push — master ( afac5a...068199 )
by 世昌
02:20
created
suda/src/application/template/compiler/EchoValueTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
         // 任意变量名: 中文点下划线英文数字
16 16
         $code = preg_replace_callback(
17 17
             '/\B[$](\?)?[:]([.\w\x{4e00}-\x{9aff}]+)(\s*)(\( ( (?>[^()]+) | (?4) )* \) )?/ux',
18
-            [$this,'echoValueCallback'],
18
+            [$this, 'echoValueCallback'],
19 19
             $var
20 20
         );
21 21
         $error = preg_last_error();
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
     
28 28
     protected function echoValueCallback($matchs)
29 29
     {
30
-        $name=$matchs[2];
31
-        if ($matchs[1]==='?') {
30
+        $name = $matchs[2];
31
+        if ($matchs[1] === '?') {
32 32
             return '$this->has("'.$name.'")';
33 33
         }
34 34
         if (isset($matchs[4])) {
35 35
             if (preg_match('/\((.+)\)/', $matchs[4], $v)) {
36 36
                 $args = trim($v[1]);
37
-                $args= strlen($args) ?','.$args:'';
37
+                $args = strlen($args) ? ','.$args : '';
38 38
                 return '$this->get("'.$name.'"'.$args.')';
39 39
             }
40 40
         }
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
     public function __construct()
39 39
     {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function registerTag(Tag $tag)
64 64
     {
65
-        $this->tags[$tag->getName()] =$tag;
65
+        $this->tags[$tag->getName()] = $tag;
66 66
     }
67 67
 
68 68
     /**
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
     public function compileText(string $text, array $tagConfig = []):string
77 77
     {
78 78
         $this->applyTagConfig($tagConfig);
79
-        $result  = '';
79
+        $result = '';
80 80
         foreach (token_get_all($text) as $token) {
81 81
             if (is_array($token)) {
82 82
                 list($tag, $content) = $token;
83 83
                 // 所有将要编译的文本
84 84
                 // 跳过各种的PHP
85 85
                 if ($tag == T_INLINE_HTML) {
86
-                    $content=$this->proccesTags($content);
87
-                    $content=$this->processCommands($content);
86
+                    $content = $this->proccesTags($content);
87
+                    $content = $this->processCommands($content);
88 88
                 }
89 89
                 $result .= $content;
90 90
             } else {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     {
109 109
         foreach ($this->tags as $tag) {
110 110
             $pregExp = sprintf('/(!)?%s\s*(.+?)\s*%s/', preg_quote($tag->getOpen()), preg_quote($tag->getClose()));
111
-            $text = preg_replace_callback($pregExp, function ($match) use ($tag) {
111
+            $text = preg_replace_callback($pregExp, function($match) use ($tag) {
112 112
                 if ($match[1] === '!') {
113 113
                     return substr($match[0], 1);
114 114
                 } else {
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
      */
127 127
     protected function processCommands(string $text):string
128 128
     {
129
-        $pregExp ='/\B\@(\!)?([\w\x{4e00}-\x{9aff}]+)(\s*)(\( ( (?>[^()]+) | (?4) )* \) )? /ux';
130
-        $code = preg_replace_callback($pregExp, [$this,'doMatchCommand'], $text);
129
+        $pregExp = '/\B\@(\!)?([\w\x{4e00}-\x{9aff}]+)(\s*)(\( ( (?>[^()]+) | (?4) )* \) )? /ux';
130
+        $code = preg_replace_callback($pregExp, [$this, 'doMatchCommand'], $text);
131 131
         $error = preg_last_error();
132 132
         if ($error !== PREG_NO_ERROR) {
133 133
             throw new Exception($error);
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             list($input, $ignore, $name, $space) = $match;
144 144
             $params = '';
145 145
         }
146
-        if ($ignore ==='!') {
146
+        if ($ignore === '!') {
147 147
             return str_replace('@!', '@', $input);
148 148
         } else {
149 149
             foreach ($this->commands as $command) {
Please login to merge, or discard this patch.
suda/src/application/template/compiler/Tag.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
         $this->content = $content;
41 41
         $this->name = $name;
42 42
         $this->open = $open;
43
-        $this->close= $close;
43
+        $this->close = $close;
44 44
     }
45 45
 
46 46
     /**
Please login to merge, or discard this patch.
suda/src/application/ModuleBag.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      * @param string $path
80 80
      * @return Module|null
81 81
      */
82
-    public function guess(string $path):?Module
82
+    public function guess(string $path): ?Module
83 83
     {
84 84
         foreach ($this->module as $module) {
85 85
             if (FileSystem::isOverflowPath($module->getPath(), $path) === false) {
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @throws ApplicationException
112 112
      * @return Module|null
113 113
      */
114
-    public function get(string $name):?Module
114
+    public function get(string $name): ?Module
115 115
     {
116 116
         $full = $this->getFullName($name);
117 117
         return  $this->module[$full];
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         if (array_key_exists($version, $this->knownsFullName[$name])) {
196 196
             return $this->knownsFullName[$name][$version];
197 197
         }
198
-        return $hasVersion?$name.':'.$version:end($this->knownsFullName[$name]);
198
+        return $hasVersion ? $name.':'.$version : end($this->knownsFullName[$name]);
199 199
     }
200 200
 
201 201
     protected function getLikeName(string $name):string
Please login to merge, or discard this patch.
suda/loader/loader.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
     }
43 43
 }
44 44
 // 加载器
45
-require_once SUDA_SYSTEM .'/src/framework/loader/Path.php';
46
-require_once SUDA_SYSTEM .'/src/framework/loader/PathTrait.php';
47
-require_once SUDA_SYSTEM .'/src/framework/loader/PathInterface.php';
48
-require_once SUDA_SYSTEM .'/src/framework/loader/IncludeManager.php';
49
-require_once SUDA_SYSTEM .'/src/framework/loader/Loader.php';
45
+require_once SUDA_SYSTEM.'/src/framework/loader/Path.php';
46
+require_once SUDA_SYSTEM.'/src/framework/loader/PathTrait.php';
47
+require_once SUDA_SYSTEM.'/src/framework/loader/PathInterface.php';
48
+require_once SUDA_SYSTEM.'/src/framework/loader/IncludeManager.php';
49
+require_once SUDA_SYSTEM.'/src/framework/loader/Loader.php';
Please login to merge, or discard this patch.
suda/src/orm/connection/MySQLConnection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
             $password = $this->config['password'] ?? '';
46 46
             $pdo = new PDO($this->getDsn(), $user, $password);
47 47
             $this->id = static::$connectionCount;
48
-            static::$connectionCount ++;
48
+            static::$connectionCount++;
49 49
             return $pdo;
50 50
         } catch (PDOException $e) {
51 51
             throw new SQLException(sprintf(
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function switchDatabase(string $database)
66 66
     {
67
-        return $this->query(new QueryStatement('USE `' . $database.'`'));
67
+        return $this->query(new QueryStatement('USE `'.$database.'`'));
68 68
     }
69 69
 
70 70
     public function rawTableName(string $name)
Please login to merge, or discard this patch.
suda/src/orm/connection/SQLiteConnection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         try {
41 41
             $pdo = new PDO($this->getDsn());
42 42
             $this->id = static::$connectionCount;
43
-            static::$connectionCount ++;
43
+            static::$connectionCount++;
44 44
             return $pdo;
45 45
         } catch (PDOException $e) {
46 46
             throw new SQLException(
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function switchDatabase(string $database)
64 64
     {
65
-        return $this->query(new QueryStatement('USE `' . $database.'`'));
65
+        return $this->query(new QueryStatement('USE `'.$database.'`'));
66 66
     }
67 67
 
68 68
     /**
Please login to merge, or discard this patch.
suda/src/application/database/creator/MySQLTableCreator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
         $table = $this->connection->rawTableName($this->name);
106 106
         $sql = "CREATE TABLE IF NOT EXISTS `{$table}` (\r\n\t";
107 107
         $sql .= implode(",\r\n\t", array_filter($content, 'strlen'));
108
-        $auto = null === $this->auto?'':'AUTO_INCREMENT='.$this->auto;
109
-        $collate = null === $this->collate?'':'COLLATE '.$this->collate;
108
+        $auto = null === $this->auto ? '' : 'AUTO_INCREMENT='.$this->auto;
109
+        $collate = null === $this->collate ? '' : 'COLLATE '.$this->collate;
110 110
         $sql .= "\r\n) ENGINE={$this->engine} {$collate} {$auto} DEFAULT CHARSET={$this->charset};";
111 111
         return $sql;
112 112
     }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             }
125 125
         }
126 126
         if (count($primary)) {
127
-            return 'PRIMARY KEY ('. implode(',', $primary).')';
127
+            return 'PRIMARY KEY ('.implode(',', $primary).')';
128 128
         }
129 129
         return  '';
130 130
     }
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
     protected function createField(Field $field)
218 218
     {
219 219
         $type = strtoupper($field->getValueType()).$this->parseLength($field->getLength());
220
-        $auto = $field->getAuto() ?'AUTO_INCREMENT':'';
221
-        $null = $field->isNullable() ?'NULL':'NOT NULL';
222
-        $attr = $field->getAttribute() ?strtoupper($field->getAttribute()):'';
223
-        $comment = $field->getComment() ?('COMMENT \''.addcslashes($field->getComment(), '\'').'\''):'';
220
+        $auto = $field->getAuto() ? 'AUTO_INCREMENT' : '';
221
+        $null = $field->isNullable() ? 'NULL' : 'NOT NULL';
222
+        $attr = $field->getAttribute() ?strtoupper($field->getAttribute()) : '';
223
+        $comment = $field->getComment() ? ('COMMENT \''.addcslashes($field->getComment(), '\'').'\'') : '';
224 224
         // default设置
225 225
         if ($field->hasDefault()) {
226 226
             if (null === $field->getDefault()) {
Please login to merge, or discard this patch.
suda/src/application/template/TemplateUtil.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
     protected static function fixConfig(Application $application, ?string $module, array $config)
45 45
     {
46 46
         if (!array_key_exists('assets-prefix', $config)) {
47
-            $config['assets-prefix'] = defined('SUDA_ASSETS') ? constant('SUDA_ASSETS'): 'assets';
47
+            $config['assets-prefix'] = defined('SUDA_ASSETS') ? constant('SUDA_ASSETS') : 'assets';
48 48
         }
49 49
         if (!array_key_exists('static', $config)) {
50 50
             $config['static'] = 'static';
51 51
         }
52 52
         if (!array_key_exists('assets-path', $config)) {
53
-            $config['assets-path'] = SUDA_PUBLIC. '/'.$config['assets-prefix'];
53
+            $config['assets-path'] = SUDA_PUBLIC.'/'.$config['assets-prefix'];
54 54
         }
55 55
         if (!array_key_exists('static-name', $config)) {
56 56
             $config['uri-name'] = static::getSafeUriName($application, $module);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $assetRoot = static::getAssetRoot($application, $module);
116 116
         if (in_array($request->getIndex(), $application->conf('index', ['/index.php']))) {
117
-            $name = static::writableAssets($application, $module) ? dirname($request->getIndex()):$request->getIndex();
117
+            $name = static::writableAssets($application, $module) ? dirname($request->getIndex()) : $request->getIndex();
118 118
             return rtrim(str_replace('\\', '/', $name), '/').$assetRoot;
119 119
         }
120 120
         return rtrim(str_replace('\\', '/', $request->getIndex()), '/').$assetRoot;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         ?string $module = null
151 151
     ):string {
152 152
         $assetRoot = static::getAssetRoot($application, $module);
153
-        $name = static::writableAssets($application, $module) ? dirname($request->getIndex()):$request->getIndex();
153
+        $name = static::writableAssets($application, $module) ? dirname($request->getIndex()) : $request->getIndex();
154 154
         return rtrim(str_replace('\\', '/', $name), '/').$assetRoot;
155 155
     }
156 156
 
Please login to merge, or discard this patch.