Passed
Push — master ( 31c00c...9c46e7 )
by 世昌
02:43
created
suda/src/orm/connection/creator/MySQLTableCreator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
         $table = $this->connection->rawTableName($this->name);
72 72
         $sql = "CREATE TABLE IF NOT EXISTS `{$table}` (\r\n\t";
73 73
         $sql .= implode(",\r\n\t", array_filter($content, 'strlen'));
74
-        $auto = null === $this->auto?'':'AUTO_INCREMENT='.$this->auto;
75
-        $collate = null === $this->collate?'':'COLLATE '.$this->collate;
74
+        $auto = null === $this->auto ? '' : 'AUTO_INCREMENT='.$this->auto;
75
+        $collate = null === $this->collate ? '' : 'COLLATE '.$this->collate;
76 76
         $sql .= "\r\n) ENGINE={$this->engine} {$collate} {$auto} DEFAULT CHARSET={$this->charset};";
77 77
         return $sql;
78 78
     }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             }
88 88
         }
89 89
         if (count($primary)) {
90
-            return 'PRIMARY KEY ('. implode(',', $primary).')';
90
+            return 'PRIMARY KEY ('.implode(',', $primary).')';
91 91
         }
92 92
         return  '';
93 93
     }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                 return '('.$length.')';
146 146
             }
147 147
             if (is_array($length)) {
148
-                return '('.implode(',',$length).')';
148
+                return '('.implode(',', $length).')';
149 149
             }
150 150
         }
151 151
         return  '';
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
     protected function createField(Field $field)
155 155
     {
156 156
         $type = strtoupper($field->getValueType()).$this->parseLength($field->getLength());
157
-        $auto = $field->getAuto() ?'AUTO_INCREMENT':'';
158
-        $null = $field->isNullable() ?'NULL':'NOT NULL';
159
-        $attr = $field->getAttribute() ?strtoupper($field->getAttribute()):'';
160
-        $comment = $field->getComment() ?('COMMENT \''.addcslashes($field->getComment(), '\'').'\''):'';
157
+        $auto = $field->getAuto() ? 'AUTO_INCREMENT' : '';
158
+        $null = $field->isNullable() ? 'NULL' : 'NOT NULL';
159
+        $attr = $field->getAttribute() ?strtoupper($field->getAttribute()) : '';
160
+        $comment = $field->getComment() ? ('COMMENT \''.addcslashes($field->getComment(), '\'').'\'') : '';
161 161
         // default设置
162 162
         if ($field->hasDefault()) {
163 163
             if (null === $field->getDefault()) {
Please login to merge, or discard this patch.