Passed
Push — dev ( ed3e65...b2f89b )
by 世昌
02:33
created
suda/src/application/database/TableCreator.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 abstract class TableCreator
13 13
 {
14 14
     protected static $map = [
15
-      'mysql' => MySQLTableCreator::class,
15
+        'mysql' => MySQLTableCreator::class,
16 16
     ];
17 17
 
18 18
     abstract function create(Connection $connection, TableStruct $fields);
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
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
         $table = $this->fields->getRealTableName($this->connection);
99 99
         $sql = "CREATE TABLE IF NOT EXISTS `{$table}` (\r\n\t";
100 100
         $sql .= implode(",\r\n\t", array_filter($content, 'strlen'));
101
-        $auto = null === $this->auto?'':'AUTO_INCREMENT='.$this->auto;
102
-        $collate = null === $this->collate?'':'COLLATE '.$this->collate;
101
+        $auto = null === $this->auto ? '' : 'AUTO_INCREMENT='.$this->auto;
102
+        $collate = null === $this->collate ? '' : 'COLLATE '.$this->collate;
103 103
         $sql .= "\r\n) ENGINE={$this->engine} {$collate} {$auto} DEFAULT CHARSET={$this->charset};";
104 104
         return $sql;
105 105
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             }
118 118
         }
119 119
         if (count($primary)) {
120
-            return 'PRIMARY KEY ('. implode(',', $primary).')';
120
+            return 'PRIMARY KEY ('.implode(',', $primary).')';
121 121
         }
122 122
         return  '';
123 123
     }
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
     protected function createField(Field $field)
211 211
     {
212 212
         $type = strtoupper($field->getValueType()).$this->parseLength($field->getLength());
213
-        $auto = $field->getAuto() ?'AUTO_INCREMENT':'';
214
-        $null = $field->isNullable() === null? '': $field->isNullable() === true ? 'NULL':'NOT NULL';
215
-        $attr = $field->getAttribute() ?strtoupper($field->getAttribute()):'';
216
-        $comment = $field->getComment() ?('COMMENT \''.addcslashes($field->getComment(), '\'').'\''):'';
213
+        $auto = $field->getAuto() ? 'AUTO_INCREMENT' : '';
214
+        $null = $field->isNullable() === null ? '' : $field->isNullable() === true ? 'NULL' : 'NOT NULL';
215
+        $attr = $field->getAttribute() ?strtoupper($field->getAttribute()) : '';
216
+        $comment = $field->getComment() ? ('COMMENT \''.addcslashes($field->getComment(), '\'').'\'') : '';
217 217
         // default设置
218 218
         if ($field->hasDefault()) {
219 219
             if (null === $field->getDefault()) {
Please login to merge, or discard this patch.