Completed
Push — master ( a1dd4f...06bac3 )
by Anton
02:36
created
src/Command/Database/TableCommand.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $database = $dbal->database($this->option('database'));
46 46
         $schema = $database->table($this->argument('table'))->getSchema();
47 47
 
48
-        if (!$schema->exists()) {
48
+        if (!$schema->exists()){
49 49
             throw new DBALException(
50 50
                 "Table {$database->getName()}.{$this->argument('table')} does not exists."
51 51
             );
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 
60 60
         $this->describeColumns($schema);
61 61
 
62
-        if (!empty($indexes = $schema->getIndexes())) {
62
+        if (!empty($indexes = $schema->getIndexes())){
63 63
             $this->describeIndexes($database, $indexes);
64 64
         }
65 65
 
66
-        if (!empty($foreignKeys = $schema->getForeignKeys())) {
66
+        if (!empty($foreignKeys = $schema->getForeignKeys())){
67 67
             $this->describeForeignKeys($database, $foreignKeys);
68 68
         }
69 69
 
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
             'Default Value:'
84 84
         ]);
85 85
 
86
-        foreach ($schema->getColumns() as $column) {
86
+        foreach ($schema->getColumns() as $column){
87 87
             $name = $column->getName();
88 88
 
89
-            if (in_array($column->getName(), $schema->getPrimaryKeys())) {
89
+            if (in_array($column->getName(), $schema->getPrimaryKeys())){
90 90
                 $name = "<fg=magenta>{$name}</fg=magenta>";
91 91
             }
92 92
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         );
116 116
 
117 117
         $indexesTable = $this->table(['Name:', 'Type:', 'Columns:']);
118
-        foreach ($indexes as $index) {
118
+        foreach ($indexes as $index){
119 119
             $indexesTable->addRow([
120 120
                 $index->getName(),
121 121
                 $index->isUnique() ? 'UNIQUE INDEX' : 'INDEX',
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             'On Update:'
147 147
         ]);
148 148
 
149
-        foreach ($foreignKeys as $reference) {
149
+        foreach ($foreignKeys as $reference){
150 150
             $foreignTable->addRow([
151 151
                 $reference->getName(),
152 152
                 join(', ', $reference->getColumns()),
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 
171 171
         $abstractType = $column->getAbstractType();
172 172
 
173
-        if ($column->getSize()) {
173
+        if ($column->getSize()){
174 174
             $type .= " ({$column->getSize()})";
175 175
         }
176 176
 
177
-        if ($abstractType == 'decimal') {
177
+        if ($abstractType == 'decimal'){
178 178
             $type .= " ({$column->getPrecision()}, {$column->getScale()})";
179 179
         }
180 180
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     {
190 190
         $abstractType = $column->getAbstractType();
191 191
 
192
-        if (in_array($abstractType, ['primary', 'bigPrimary'])) {
192
+        if (in_array($abstractType, ['primary', 'bigPrimary'])){
193 193
             $abstractType = "<fg=magenta>{$abstractType}</fg=magenta>";
194 194
         }
195 195
 
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
     {
205 205
         $defaultValue = $column->getDefaultValue();
206 206
 
207
-        if ($defaultValue instanceof FragmentInterface) {
207
+        if ($defaultValue instanceof FragmentInterface){
208 208
             $value = $defaultValue->compile(new QueryBindings(), $driver->getCompiler());
209 209
             return "<info>{$value}</info>";
210 210
         }
211 211
 
212
-        if ($defaultValue instanceof \DateTimeInterface) {
212
+        if ($defaultValue instanceof \DateTimeInterface){
213 213
             $defaultValue = $defaultValue->format('c');
214 214
         }
215 215
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -12 removed lines patch added patch discarded remove patch
@@ -45,7 +45,8 @@  discard block
 block discarded – undo
45 45
         $database = $dbal->database($this->option('database'));
46 46
         $schema = $database->table($this->argument('table'))->getSchema();
47 47
 
48
-        if (!$schema->exists()) {
48
+        if (!$schema->exists())
49
+        {
49 50
             throw new DBALException(
50 51
                 "Table {$database->getName()}.{$this->argument('table')} does not exists."
51 52
             );
@@ -59,11 +60,13 @@  discard block
 block discarded – undo
59 60
 
60 61
         $this->describeColumns($schema);
61 62
 
62
-        if (!empty($indexes = $schema->getIndexes())) {
63
+        if (!empty($indexes = $schema->getIndexes()))
64
+        {
63 65
             $this->describeIndexes($database, $indexes);
64 66
         }
65 67
 
66
-        if (!empty($foreignKeys = $schema->getForeignKeys())) {
68
+        if (!empty($foreignKeys = $schema->getForeignKeys()))
69
+        {
67 70
             $this->describeForeignKeys($database, $foreignKeys);
68 71
         }
69 72
 
@@ -83,10 +86,12 @@  discard block
 block discarded – undo
83 86
             'Default Value:'
84 87
         ]);
85 88
 
86
-        foreach ($schema->getColumns() as $column) {
89
+        foreach ($schema->getColumns() as $column)
90
+        {
87 91
             $name = $column->getName();
88 92
 
89
-            if (in_array($column->getName(), $schema->getPrimaryKeys())) {
93
+            if (in_array($column->getName(), $schema->getPrimaryKeys()))
94
+            {
90 95
                 $name = "<fg=magenta>{$name}</fg=magenta>";
91 96
             }
92 97
 
@@ -115,7 +120,8 @@  discard block
 block discarded – undo
115 120
         );
116 121
 
117 122
         $indexesTable = $this->table(['Name:', 'Type:', 'Columns:']);
118
-        foreach ($indexes as $index) {
123
+        foreach ($indexes as $index)
124
+        {
119 125
             $indexesTable->addRow([
120 126
                 $index->getName(),
121 127
                 $index->isUnique() ? 'UNIQUE INDEX' : 'INDEX',
@@ -146,7 +152,8 @@  discard block
 block discarded – undo
146 152
             'On Update:'
147 153
         ]);
148 154
 
149
-        foreach ($foreignKeys as $reference) {
155
+        foreach ($foreignKeys as $reference)
156
+        {
150 157
             $foreignTable->addRow([
151 158
                 $reference->getName(),
152 159
                 join(', ', $reference->getColumns()),
@@ -170,11 +177,13 @@  discard block
 block discarded – undo
170 177
 
171 178
         $abstractType = $column->getAbstractType();
172 179
 
173
-        if ($column->getSize()) {
180
+        if ($column->getSize())
181
+        {
174 182
             $type .= " ({$column->getSize()})";
175 183
         }
176 184
 
177
-        if ($abstractType == 'decimal') {
185
+        if ($abstractType == 'decimal')
186
+        {
178 187
             $type .= " ({$column->getPrecision()}, {$column->getScale()})";
179 188
         }
180 189
 
@@ -189,7 +198,8 @@  discard block
 block discarded – undo
189 198
     {
190 199
         $abstractType = $column->getAbstractType();
191 200
 
192
-        if (in_array($abstractType, ['primary', 'bigPrimary'])) {
201
+        if (in_array($abstractType, ['primary', 'bigPrimary']))
202
+        {
193 203
             $abstractType = "<fg=magenta>{$abstractType}</fg=magenta>";
194 204
         }
195 205
 
@@ -204,12 +214,14 @@  discard block
 block discarded – undo
204 214
     {
205 215
         $defaultValue = $column->getDefaultValue();
206 216
 
207
-        if ($defaultValue instanceof FragmentInterface) {
217
+        if ($defaultValue instanceof FragmentInterface)
218
+        {
208 219
             $value = $defaultValue->compile(new QueryBindings(), $driver->getCompiler());
209 220
             return "<info>{$value}</info>";
210 221
         }
211 222
 
212
-        if ($defaultValue instanceof \DateTimeInterface) {
223
+        if ($defaultValue instanceof \DateTimeInterface)
224
+        {
213 225
             $defaultValue = $defaultValue->format('c');
214 226
         }
215 227
 
Please login to merge, or discard this patch.