Passed
Branch dev (c7b1a7)
by 世昌
03:16
created
suda/src/application/database/Table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     public function __construct(string $tableName, bool $raw = false)
24 24
     {
25 25
         parent::__construct(
26
-            $this->initStruct($tableName,$raw),
26
+            $this->initStruct($tableName, $raw),
27 27
             Database::application()->getDataSource(),
28 28
             $this);
29 29
     }
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->fields->getRealTableName($this->connection);
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.