Test Setup Failed
Push — master ( 0e2875...7d63a7 )
by Php Easy Api
04:46
created
src/resta/Console/Source/Migration/Migration.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     /**
16 16
      * @var $type
17 17
      */
18
-    public $type='migration';
18
+    public $type = 'migration';
19 19
 
20 20
     /**
21 21
      * @var array
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * @var $commandRule
35 35
      */
36
-    public $commandRule=['create'=>[
37
-        'name','table'
36
+    public $commandRule = ['create'=>[
37
+        'name', 'table'
38 38
     ],
39 39
         'push'=>[]];
40 40
 
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 
64 64
         foreach ($pushResult as $key=>$value) {
65 65
 
66
-            if(isset($value['success'])){
66
+            if (isset($value['success'])) {
67 67
 
68 68
                 $list[] = true;
69 69
 
70
-                $pushResultFile = explode("/",$pushResult[$key]['file']);
70
+                $pushResultFile = explode("/", $pushResult[$key]['file']);
71 71
                 $file = end($pushResultFile);
72 72
 
73
-                if($pushResult[$key]['success']===true){
73
+                if ($pushResult[$key]['success']===true) {
74 74
 
75 75
                     $this->table->addRow([
76 76
                         $key,
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                         'No',
83 83
                     ]);
84 84
                 }
85
-                else{
85
+                else {
86 86
 
87 87
                     $this->table->addRow([
88 88
                         $key,
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
             }
99 99
         }
100 100
 
101
-        if(count($list)){
102
-            $this->table->setHeaders(['id','table','file','type','status','message','seeder']);
101
+        if (count($list)) {
102
+            $this->table->setHeaders(['id', 'table', 'file', 'type', 'status', 'message', 'seeder']);
103 103
 
104 104
             echo $this->table->getTable();
105 105
         }
106
-        else{
106
+        else {
107 107
             echo $this->classical('No migration was found to apply');
108 108
         }
109 109
 
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 
125 125
         $stubType = (!file_exists($tablePath)) ? 'create' : 'alter';
126 126
 
127
-        if(!file_exists($path)){
127
+        if (!file_exists($path)) {
128 128
 
129
-            $this->file->fs->mkdir($path,0777);
130
-            $this->file->fs->chmod($path,0777,000,true);
129
+            $this->file->fs->mkdir($path, 0777);
130
+            $this->file->fs->chmod($path, 0777, 000, true);
131 131
         }
132 132
 
133
-        $migrationCreate = $this->getSchema()->stub($this->argument['table'],$this->argument['name'],$stubType);
133
+        $migrationCreate = $this->getSchema()->stub($this->argument['table'], $this->argument['name'], $stubType);
134 134
 
135 135
         echo $this->info('Migration Create Process :');
136 136
 
137
-        $this->table->setHeaders(['id','method','table','style','name','type','status','message']);
137
+        $this->table->setHeaders(['id', 'method', 'table', 'style', 'name', 'type', 'status', 'message']);
138 138
 
139
-        foreach ($migrationCreate['directory'] as $key=>$data){
139
+        foreach ($migrationCreate['directory'] as $key=>$data) {
140 140
 
141 141
             $this->table->addRow([
142 142
                 $key,
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             ]);
152 152
         }
153 153
 
154
-        foreach ($migrationCreate['file'] as $key=>$data){
154
+        foreach ($migrationCreate['file'] as $key=>$data) {
155 155
 
156 156
             $this->table->addRow([
157 157
                 $key,
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
                         'Ok',
82 82
                         'No',
83 83
                     ]);
84
-                }
85
-                else{
84
+                } else{
86 85
 
87 86
                     $this->table->addRow([
88 87
                         $key,
@@ -102,8 +101,7 @@  discard block
 block discarded – undo
102 101
             $this->table->setHeaders(['id','table','file','type','status','message','seeder']);
103 102
 
104 103
             echo $this->table->getTable();
105
-        }
106
-        else{
104
+        } else{
107 105
             echo $this->classical('No migration was found to apply');
108 106
         }
109 107
 
Please login to merge, or discard this patch.
src/resta/Database/Migration/Src/Resource/PullManager/Pulling.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public function get()
16 16
     {
17
-        if(!isset($this->config['paths'][0])){
17
+        if (!isset($this->config['paths'][0])) {
18 18
             exit();
19 19
         }
20 20
         
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 
28 28
         $list = [];
29 29
 
30
-        foreach ($migrations as $table=>$item){
30
+        foreach ($migrations as $table=>$item) {
31 31
             $list[] = strtolower($table);
32 32
         }
33 33
         
34
-        if(isset($arguments['only'])){
34
+        if (isset($arguments['only'])) {
35 35
             $dbtables = $this->getOnly($dbtables);
36 36
         }
37 37
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         echo 'Toplam : '.count($dbtables).' Table';
41 41
         echo PHP_EOL;
42 42
 
43
-        foreach ($dbtables as $dbtablekey=>$dbtable){
43
+        foreach ($dbtables as $dbtablekey=>$dbtable) {
44 44
 
45 45
             $dbtablekey = $dbtablekey+1;
46 46
 
@@ -49,40 +49,40 @@  discard block
 block discarded – undo
49 49
             $dbtable = ucfirst($dbtable);
50 50
             $makeDirectory = $directory.''.DIRECTORY_SEPARATOR.''.$dbtable;
51 51
 
52
-            if(!file_exists($makeDirectory)){
53
-                files()->makeDirectory($makeDirectory,0755,true);
54
-                $exist=false;
52
+            if (!file_exists($makeDirectory)) {
53
+                files()->makeDirectory($makeDirectory, 0755, true);
54
+                $exist = false;
55 55
             }
56
-            else{
57
-                $exist=true;
56
+            else {
57
+                $exist = true;
58 58
             }
59 59
 
60 60
             $migrationName = time().'_'.$dbtable.'';
61 61
 
62
-            if($exist===false){
62
+            if ($exist===false) {
63 63
 
64
-                $content = $this->getContentFile($this->getStubPath().''.DIRECTORY_SEPARATOR.'pullCreate.stub',[
64
+                $content = $this->getContentFile($this->getStubPath().''.DIRECTORY_SEPARATOR.'pullCreate.stub', [
65 65
                     'className' => $dbtable,
66 66
                     'informations' => $informations
67 67
                 ]);
68 68
 
69
-                $contentResult = files()->put($makeDirectory.''.DIRECTORY_SEPARATOR.''.$migrationName.'.php',$content);
69
+                $contentResult = files()->put($makeDirectory.''.DIRECTORY_SEPARATOR.''.$migrationName.'.php', $content);
70 70
             }
71 71
 
72
-            if(substr($dbtable,-1)=='s'){
73
-                app()->command('model create','model:'.strtolower(substr($dbtable,0,-1)).' table:'.$dbtable);
72
+            if (substr($dbtable, -1)=='s') {
73
+                app()->command('model create', 'model:'.strtolower(substr($dbtable, 0, -1)).' table:'.$dbtable);
74 74
             }
75
-            else{
76
-                app()->command('model create','model:'.strtolower($dbtable).' table:'.$dbtable);
75
+            else {
76
+                app()->command('model create', 'model:'.strtolower($dbtable).' table:'.$dbtable);
77 77
             }
78 78
 
79
-            if(isset($contentResult) && $contentResult!==false){
79
+            if (isset($contentResult) && $contentResult!==false) {
80 80
                 echo $dbtablekey.'- '.$migrationName.' ---> Ok';
81 81
             }
82
-            elseif($exist){
82
+            elseif ($exist) {
83 83
                 echo $dbtablekey.'- '.$migrationName.' ---> (Already Exist)';
84 84
             }
85
-            else{
85
+            else {
86 86
                 echo $dbtablekey.'- '.$migrationName.' ---> Fail';
87 87
             }
88 88
 
@@ -110,46 +110,46 @@  discard block
 block discarded – undo
110 110
 
111 111
         $list = [];
112 112
 
113
-        foreach ($columns as $key=>$data){
113
+        foreach ($columns as $key=>$data) {
114 114
 
115
-            $data['Type'] = rtrim(str_replace('unsigned','',$data['Type']));
115
+            $data['Type'] = rtrim(str_replace('unsigned', '', $data['Type']));
116 116
 
117 117
             $field      = $data['Field'];
118 118
             $list[]     = '$wizard->name(\''.$field.'\')';
119 119
             $list[]     = '->'.$this->getColumnTransformers($data['Type']).'';
120 120
 
121 121
             //default block
122
-            if(!is_null($data['Default'])){
122
+            if (!is_null($data['Default'])) {
123 123
                 $default = $data['Default'];
124
-                $list[]     = '->default(\''.$default.'\')';
124
+                $list[] = '->default(\''.$default.'\')';
125 125
             }
126 126
 
127
-            $getIndex = $this->getIndexInformation($indexes,$data['Field']);
127
+            $getIndex = $this->getIndexInformation($indexes, $data['Field']);
128 128
 
129 129
             //unique block
130
-            if($getIndex['Non_unique']=='0' && $getIndex['Key_name']!=='PRIMARY'){
130
+            if ($getIndex['Non_unique']=='0' && $getIndex['Key_name']!=='PRIMARY') {
131 131
                 $indexName = $getIndex['Key_name'];
132
-                $list[]     = '->unique(\''.$indexName.'\')';
132
+                $list[] = '->unique(\''.$indexName.'\')';
133 133
             }
134 134
 
135 135
             //index block
136
-            if($getIndex['Non_unique']=='1' && $getIndex['Key_name']!=='PRIMARY'){
136
+            if ($getIndex['Non_unique']=='1' && $getIndex['Key_name']!=='PRIMARY') {
137 137
                 $columnName = $getIndex['Column_name'];
138 138
                 $indexName = $getIndex['Key_name'];
139 139
 
140
-                if(count($multipleIndexes[$indexName])==1){
140
+                if (count($multipleIndexes[$indexName])==1) {
141 141
                     $list[] = '->index(\''.$indexName.'\')';
142 142
                 }
143 143
             }
144 144
 
145 145
             //comment block
146
-            if(strlen($data['Comment'])>0){
146
+            if (strlen($data['Comment'])>0) {
147 147
                 $comment = $data['Comment'];
148 148
                 $list[] = '->comment(\''.$comment.'\')';
149 149
             }
150 150
 
151 151
             //auto increment block
152
-            if($data['Extra']=='auto_increment'){
152
+            if ($data['Extra']=='auto_increment') {
153 153
                 $list[] = '->auto_increment()';
154 154
             }
155 155
 
@@ -164,39 +164,39 @@  discard block
 block discarded – undo
164 164
 
165 165
         //table indexes
166 166
         foreach ($multipleIndexes as $indexName=>$values) {
167
-            if(count($values)>1){
168
-                $values = '\''.implode('\',\'',$values).'\'';
167
+            if (count($values)>1) {
168
+                $values = '\''.implode('\',\'', $values).'\'';
169 169
                 $list[] = '    $wizard->table()->indexes(\''.$indexName.'\',['.$values.']);
170 170
                 ';
171 171
             }
172 172
         }
173 173
 
174
-        if(count($foreignKeys)){
174
+        if (count($foreignKeys)) {
175 175
 
176 176
             $constraintName = $foreignKeys['CONSTRAINT_NAME'];
177 177
             $key = $foreignKeys['COLUMN_NAME'];
178 178
             $referenceTable = $foreignKeys['REFERENCED_TABLE_NAME'];
179 179
             $referenceColumn = $foreignKeys['REFERENCED_COLUMN_NAME'];
180 180
 
181
-            if($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT'){
181
+            if ($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT') {
182 182
                 $list[] = '    $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\');
183 183
                 ';
184 184
             }
185 185
 
186
-            if($foreignKeys['UPDATE_RULE']!=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT'){
186
+            if ($foreignKeys['UPDATE_RULE']!=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT') {
187 187
                 $rule = $foreignKeys['UPDATE_RULE'];
188 188
                 $list[] = '    $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\')->onUpdate()->'.strtolower($rule).'();
189 189
                 ';
190 190
             }
191 191
 
192
-            if($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']!=='RESTRICT'){
192
+            if ($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']!=='RESTRICT') {
193 193
                 $rule = $foreignKeys['DELETE_RULE'];
194 194
                 $list[] = '    $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\')->onDelete()->'.strtolower($rule).'();
195 195
                 ';
196 196
             }
197 197
         }
198 198
 
199
-        return implode('',$list);
199
+        return implode('', $list);
200 200
     }
201 201
 
202 202
     /**
@@ -207,43 +207,43 @@  discard block
 block discarded – undo
207 207
      */
208 208
     private function getColumnTransformers($column)
209 209
     {
210
-        if($column=='datetime'){
210
+        if ($column=='datetime') {
211 211
             return 'datetime()';
212 212
         }
213
-        elseif($column=='longtext'){
213
+        elseif ($column=='longtext') {
214 214
             return 'longtext()';
215 215
         }
216
-        elseif($column=='date'){
216
+        elseif ($column=='date') {
217 217
             return 'date()';
218 218
         }
219
-        elseif($column=='text'){
219
+        elseif ($column=='text') {
220 220
             return 'text()';
221 221
         }
222
-        elseif($column=='timestamp'){
222
+        elseif ($column=='timestamp') {
223 223
             return 'timestamp()';
224 224
         }
225
-        elseif($column=='mediumint'){
225
+        elseif ($column=='mediumint') {
226 226
             return 'mediumint()';
227 227
         }
228
-        elseif($column=='tinyint'){
228
+        elseif ($column=='tinyint') {
229 229
             return 'tinyint()';
230 230
         }
231
-        elseif($column=='float'){
231
+        elseif ($column=='float') {
232 232
             return 'float()';
233 233
         }
234
-        elseif($column=='mediumtext'){
234
+        elseif ($column=='mediumtext') {
235 235
             return 'mediumtext()';
236 236
         }
237
-        elseif($column=='mediumblob'){
237
+        elseif ($column=='mediumblob') {
238 238
             return 'mediumblob()';
239 239
         }
240
-        elseif($column=='blob'){
240
+        elseif ($column=='blob') {
241 241
             return 'blob()';
242 242
         }
243
-        elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){
243
+        elseif (preg_match('@enum.*\((.*?)\)@', $column, $enum)) {
244 244
             return 'enum(['.$enum[1].'])';
245 245
         }
246
-        else{
246
+        else {
247 247
             return $column;
248 248
         }
249 249
     }
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
      * @param $field
256 256
      * @return void|mixed
257 257
      */
258
-    private function getIndexInformation($index,$field)
258
+    private function getIndexInformation($index, $field)
259 259
     {
260 260
         foreach ($index as $key=>$item) {
261 261
 
262
-            if($item['Column_name'] == $field){
262
+            if ($item['Column_name']==$field) {
263 263
                 return $index[$key];
264 264
             }
265 265
         }
@@ -277,13 +277,13 @@  discard block
 block discarded – undo
277 277
     {
278 278
         $arguments = $this->schema->getArguments();
279 279
         
280
-        $only = explode(',',$arguments['only']);
280
+        $only = explode(',', $arguments['only']);
281 281
         
282 282
         $list = [];
283 283
         
284
-        foreach($only as $table){
284
+        foreach ($only as $table) {
285 285
             
286
-            if(in_array($table,$tables) || in_array($table = strtolower($table),$tables)){
286
+            if (in_array($table, $tables) || in_array($table = strtolower($table), $tables)) {
287 287
                 $list[] = $table;
288 288
             }
289 289
         }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     {
303 303
         $list = [];
304 304
         foreach ($index as $key=>$item) {
305
-            if($item['Non_unique']==1 && $item['Key_name']!=='PRIMARY'){
305
+            if ($item['Non_unique']==1 && $item['Key_name']!=='PRIMARY') {
306 306
                 $list[$item['Key_name']][] = $item['Column_name'];
307 307
             }
308 308
         }
Please login to merge, or discard this patch.
src/resta/Database/Migration/Src/Resource/PushManager/PushingProcess.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,25 +11,25 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function processHandler()
13 13
     {
14
-        return $this->errorHandler(function(){
14
+        return $this->errorHandler(function() {
15 15
             
16 16
             $results = [];
17 17
             
18
-            foreach ($this->list as $table =>$datas){
18
+            foreach ($this->list as $table =>$datas) {
19 19
 
20
-                foreach ($datas as $data){
20
+                foreach ($datas as $data) {
21 21
                     
22
-                    $query = $this->queryBuilder($table,$data);
22
+                    $query = $this->queryBuilder($table, $data);
23 23
 
24 24
                     $query = $query->handle();
25 25
                     
26
-                    if($query===false){
26
+                    if ($query===false) {
27 27
                         $results[] = [];
28 28
                     }
29
-                    else{
30
-                        $status =($query['result']!==false) ? true : false;
29
+                    else {
30
+                        $status = ($query['result']!==false) ? true : false;
31 31
 
32
-                        $results[]= [
32
+                        $results[] = [
33 33
                             'success'=>$status,
34 34
                             'file'=>$data->getFile(),
35 35
                             'table'=>$table,
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         {
58 58
             foreach ($objects as $object)
59 59
             {
60
-                if(count($object->getError())){
60
+                if (count($object->getError())) {
61 61
                     return 'error : '.$object->getFile().' -> '.$object->getError()[0].'';
62 62
                 }
63 63
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@
 block discarded – undo
25 25
                     
26 26
                     if($query===false){
27 27
                         $results[] = [];
28
-                    }
29
-                    else{
28
+                    } else{
30 29
                         $status =($query['result']!==false) ? true : false;
31 30
 
32 31
                         $results[]= [
Please login to merge, or discard this patch.
src/resta/Database/Migration/Src/GrammarStructure/Mysql/QuerySyntax.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -27,32 +27,32 @@  discard block
 block discarded – undo
27 27
 
28 28
         $this->getDefaultSyntaxGroup();
29 29
 
30
-        $this->syntax[]=')';
30
+        $this->syntax[] = ')';
31 31
 
32 32
         //get table collation
33
-        if(isset($this->data['tableCollation']['table'])){
34
-            $this->syntax[]=' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table'];
33
+        if (isset($this->data['tableCollation']['table'])) {
34
+            $this->syntax[] = ' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table'];
35 35
         }
36
-        else{
37
-            $this->syntax[]=' DEFAULT CHARACTER SET utf8';
36
+        else {
37
+            $this->syntax[] = ' DEFAULT CHARACTER SET utf8';
38 38
         }
39 39
 
40 40
         //get engine
41
-        if($this->data['engine']!==null)
41
+        if ($this->data['engine']!==null)
42 42
         {
43
-            $this->syntax[]=' ENGINE='.$this->data['engine'].' ';
43
+            $this->syntax[] = ' ENGINE='.$this->data['engine'].' ';
44 44
         }
45
-        else{
46
-            $this->syntax[]=' ENGINE=InnoDB ';
45
+        else {
46
+            $this->syntax[] = ' ENGINE=InnoDB ';
47 47
         }
48 48
 
49
-        $syntax = implode("",$this->syntax);
49
+        $syntax = implode("", $this->syntax);
50 50
 
51
-        if(in_array($this->table,$existTables)){
51
+        if (in_array($this->table, $existTables)) {
52 52
             return false;
53 53
         }
54
-        else{
55
-            $query=$this->schema->getConnection()->setQueryBasic($syntax);
54
+        else {
55
+            $query = $this->schema->getConnection()->setQueryBasic($syntax);
56 56
 
57 57
             return [
58 58
                 'syntax'=>$syntax,
@@ -70,25 +70,25 @@  discard block
 block discarded – undo
70 70
     private function getDefaultSyntaxGroup()
71 71
     {
72 72
 
73
-        $this->syntax[]=implode(",",$this->getCreateDefaultList());
73
+        $this->syntax[] = implode(",", $this->getCreateDefaultList());
74 74
 
75 75
         //get unique values
76
-        if(isset($this->data['uniqueValueList']) && count($this->data['uniqueValueList'])){
77
-            $this->syntax[]=','.implode(',',$this->data['uniqueValueList']);
76
+        if (isset($this->data['uniqueValueList']) && count($this->data['uniqueValueList'])) {
77
+            $this->syntax[] = ','.implode(',', $this->data['uniqueValueList']);
78 78
         }
79 79
 
80 80
         //get index values
81
-        if(isset($this->data['indexValueList']) && count($this->data['indexValueList'])){
82
-            $this->syntax[]=','.implode(',',$this->data['indexValueList']);
81
+        if (isset($this->data['indexValueList']) && count($this->data['indexValueList'])) {
82
+            $this->syntax[] = ','.implode(',', $this->data['indexValueList']);
83 83
         }
84 84
 
85 85
         //get index values for key
86
-        if(count($this->getKeyList())){
87
-            $this->syntax[]=','.implode(',',$this->getKeyList());
86
+        if (count($this->getKeyList())) {
87
+            $this->syntax[] = ','.implode(',', $this->getKeyList());
88 88
         }
89 89
 
90
-        if(count($this->data['references'])){
91
-            $this->syntax[]=$this->getReferenceSyntax($this->data['references']);
90
+        if (count($this->data['references'])) {
91
+            $this->syntax[] = $this->getReferenceSyntax($this->data['references']);
92 92
         }
93 93
     }
94 94
 
@@ -112,33 +112,33 @@  discard block
 block discarded – undo
112 112
     
113 113
     private function change($alterType)
114 114
     {
115
-        if(isset($alterType['place'])){
115
+        if (isset($alterType['place'])) {
116 116
 
117
-            foreach ($alterType['place'] as $placeKey=>$placeValue){
118
-                $placeList=$placeKey .' '.$placeValue.'';
117
+            foreach ($alterType['place'] as $placeKey=>$placeValue) {
118
+                $placeList = $placeKey.' '.$placeValue.'';
119 119
             }
120 120
 
121
-            $syntax = implode("",$this->syntax);
121
+            $syntax = implode("", $this->syntax);
122 122
             
123 123
             $columns = $this->schema->getConnection()->showColumnsFrom($this->table);
124 124
             
125
-            foreach ($columns as $columnKey=>$columnData){
126
-                if($columnData['Field']==$placeValue){
125
+            foreach ($columns as $columnKey=>$columnData) {
126
+                if ($columnData['Field']==$placeValue) {
127 127
                     $changeAbleField = $columns[$columnKey+1]['Field'];
128 128
                 }
129 129
             }
130 130
             
131
-            $syntaxList = explode(' ',$syntax);
131
+            $syntaxList = explode(' ', $syntax);
132 132
 
133
-            if(current($syntaxList)!==$changeAbleField){
134
-                $alterSytanx = 'ALTER TABLE '.$this->table.' change '.$changeAbleField.' '.current($syntaxList).'  '.implode(' ',array_splice($syntaxList,1)).' '.$placeList;
133
+            if (current($syntaxList)!==$changeAbleField) {
134
+                $alterSytanx = 'ALTER TABLE '.$this->table.' change '.$changeAbleField.' '.current($syntaxList).'  '.implode(' ', array_splice($syntaxList, 1)).' '.$placeList;
135 135
             }
136
-            else{
136
+            else {
137 137
                 $alterSytanx = 'ALTER TABLE '.$this->table.' modify '.$syntax.' '.$placeList;
138 138
             }
139 139
             
140 140
 
141
-            $query=$this->schema->getConnection()->setQueryBasic($alterSytanx);
141
+            $query = $this->schema->getConnection()->setQueryBasic($alterSytanx);
142 142
 
143 143
             return [
144 144
                 'syntax'=>$syntax,
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
 
152 152
     private function addColumn($alterType)
153 153
     {
154
-        if(isset($alterType['place'])){
154
+        if (isset($alterType['place'])) {
155 155
 
156
-            foreach ($alterType['place'] as $placeKey=>$placeValue){
157
-                $placeList=$placeKey .' '.$placeValue.'';
156
+            foreach ($alterType['place'] as $placeKey=>$placeValue) {
157
+                $placeList = $placeKey.' '.$placeValue.'';
158 158
             }
159 159
 
160
-            $syntax = implode("",$this->syntax);
160
+            $syntax = implode("", $this->syntax);
161 161
 
162 162
             $alterSytanx = 'ALTER TABLE '.$this->table.' ADD COLUMN '.$syntax.' '.$placeList;
163 163
 
164
-            $query=$this->schema->getConnection()->setQueryBasic($alterSytanx);
164
+            $query = $this->schema->getConnection()->setQueryBasic($alterSytanx);
165 165
 
166 166
             return [
167 167
                 'syntax'=>$syntax,
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
         //get table collation
33 33
         if(isset($this->data['tableCollation']['table'])){
34 34
             $this->syntax[]=' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table'];
35
-        }
36
-        else{
35
+        } else{
37 36
             $this->syntax[]=' DEFAULT CHARACTER SET utf8';
38 37
         }
39 38
 
@@ -41,8 +40,7 @@  discard block
 block discarded – undo
41 40
         if($this->data['engine']!==null)
42 41
         {
43 42
             $this->syntax[]=' ENGINE='.$this->data['engine'].' ';
44
-        }
45
-        else{
43
+        } else{
46 44
             $this->syntax[]=' ENGINE=InnoDB ';
47 45
         }
48 46
 
@@ -50,8 +48,7 @@  discard block
 block discarded – undo
50 48
 
51 49
         if(in_array($this->table,$existTables)){
52 50
             return false;
53
-        }
54
-        else{
51
+        } else{
55 52
             $query=$this->schema->getConnection()->setQueryBasic($syntax);
56 53
 
57 54
             return [
@@ -132,8 +129,7 @@  discard block
 block discarded – undo
132 129
 
133 130
             if(current($syntaxList)!==$changeAbleField){
134 131
                 $alterSytanx = 'ALTER TABLE '.$this->table.' change '.$changeAbleField.' '.current($syntaxList).'  '.implode(' ',array_splice($syntaxList,1)).' '.$placeList;
135
-            }
136
-            else{
132
+            } else{
137 133
                 $alterSytanx = 'ALTER TABLE '.$this->table.' modify '.$syntax.' '.$placeList;
138 134
             }
139 135
             
Please login to merge, or discard this patch.