Test Setup Failed
Push — master ( f59ac2...e4456a )
by Php Easy Api
03:41
created
src/resta/Database/Migration/Src/SchemaCapsule.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param $file
38 38
      * @param $table
39 39
      */
40
-    public function __construct($config,$file,$table)
40
+    public function __construct($config, $file, $table)
41 41
     {
42 42
         $this->config                       = $config;
43 43
         $this->file                         = $file;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function alter(callable $callback)
54 54
     {
55
-        return $this->callbackWizardInstance(__FUNCTION__,$callback);
55
+        return $this->callbackWizardInstance(__FUNCTION__, $callback);
56 56
     }
57 57
 
58 58
     /**
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function create(callable $callback)
63 63
     {
64
-        return $this->callbackWizardInstance(__FUNCTION__,$callback);
64
+        return $this->callbackWizardInstance(__FUNCTION__, $callback);
65 65
     }
66 66
 
67 67
     /**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     private function checkErrors($wizard)
71 71
     {
72 72
         $alterType = $wizard->getAlterType();
73
-        if(count($wizard->getNames())!==count($wizard->getTypes()) && (isset($alterType['group'])) && $alterType['group']!=='dropColumn'){
73
+        if (count($wizard->getNames())!==count($wizard->getTypes()) && (isset($alterType['group'])) && $alterType['group']!=='dropColumn') {
74 74
             $wizard->setError('name and types are not equal');
75 75
         }
76 76
     }
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
      * @param $method
107 107
      * @return string
108 108
      */
109
-    private function callbackWizardInstance($method,callable $callback)
109
+    private function callbackWizardInstance($method, callable $callback)
110 110
     {
111 111
         $wizardInstance = $this->getWizardInstance($method);
112 112
 
113
-        $callbackReturn = call_user_func_array($callback,[$wizardInstance]);
113
+        $callbackReturn = call_user_func_array($callback, [$wizardInstance]);
114 114
 
115 115
         $this->checkErrors($wizardInstance);
116 116
 
Please login to merge, or discard this patch.
Database/Migration/Src/GrammarStructure/Mysql/Wizard/WizardAlterGroup.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     private function getWizardAlterInstance($group)
48 48
     {
49
-        $this->setAlterType('group',$group);
49
+        $this->setAlterType('group', $group);
50 50
 
51 51
         return new WizardAlter($this);
52 52
     }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     private function dropWizardAlterInstance($group)
59 59
     {
60
-        $this->setAlterType('group',$group);
60
+        $this->setAlterType('group', $group);
61 61
 
62 62
         return $this;
63 63
     }
Please login to merge, or discard this patch.
src/resta/Database/Migration/Src/GrammarStructure/Mysql/QuerySyntax.php 2 patches
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -32,25 +32,25 @@  discard block
 block discarded – undo
32 32
      */
33 33
     private function addColumn($alterType)
34 34
     {
35
-        if(isset($alterType['place'])){
35
+        if (isset($alterType['place'])) {
36 36
 
37 37
 
38
-            foreach ($alterType['place'] as $placeKey=>$placeValue){
39
-                $placeList=$placeKey .' '.$placeValue.'';
38
+            foreach ($alterType['place'] as $placeKey=>$placeValue) {
39
+                $placeList = $placeKey.' '.$placeValue.'';
40 40
             }
41 41
 
42
-            $syntax = implode("",$this->syntax);
42
+            $syntax = implode("", $this->syntax);
43 43
 
44 44
             $alterSytanx = 'ALTER TABLE '.$this->table.' ADD COLUMN '.$syntax.' '.$placeList;
45 45
 
46
-            $query=$this->schema->getConnection()->setQueryBasic($alterSytanx);
46
+            $query = $this->schema->getConnection()->setQueryBasic($alterSytanx);
47 47
 
48
-            if(count($this->alterExtras)){
49
-                foreach($this->alterExtras as $extra){
48
+            if (count($this->alterExtras)) {
49
+                foreach ($this->alterExtras as $extra) {
50 50
 
51 51
                     $extraSyntax = 'ALTER TABLE '.$this->table.' '.$extra.'';
52 52
 
53
-                    $query=$this->schema->getConnection()->setQueryBasic($extraSyntax);
53
+                    $query = $this->schema->getConnection()->setQueryBasic($extraSyntax);
54 54
                 }
55 55
             }
56 56
 
@@ -74,40 +74,40 @@  discard block
 block discarded – undo
74 74
      */
75 75
     private function change($alterType)
76 76
     {
77
-        if(isset($alterType['place'])){
77
+        if (isset($alterType['place'])) {
78 78
 
79
-            foreach ($alterType['place'] as $placeKey=>$placeValue){
80
-                $placeList=$placeKey .' '.$placeValue.'';
79
+            foreach ($alterType['place'] as $placeKey=>$placeValue) {
80
+                $placeList = $placeKey.' '.$placeValue.'';
81 81
             }
82 82
 
83
-            $syntax = implode("",$this->syntax);
83
+            $syntax = implode("", $this->syntax);
84 84
 
85 85
             $columns = $this->schema->getConnection()->showColumnsFrom($this->table);
86 86
 
87
-            foreach ($columns as $columnKey=>$columnData){
88
-                if($columnData['Field']==$placeValue){
87
+            foreach ($columns as $columnKey=>$columnData) {
88
+                if ($columnData['Field']==$placeValue) {
89 89
                     $changeAbleField = $columns[$columnKey+1]['Field'];
90 90
                 }
91 91
             }
92 92
 
93
-            $syntaxList = explode(' ',$syntax);
93
+            $syntaxList = explode(' ', $syntax);
94 94
 
95
-            if(current($syntaxList)!==$changeAbleField){
96
-                $alterSytanx = 'ALTER TABLE '.$this->table.' change '.$changeAbleField.' '.current($syntaxList).'  '.implode(' ',array_splice($syntaxList,1)).' '.$placeList;
95
+            if (current($syntaxList)!==$changeAbleField) {
96
+                $alterSytanx = 'ALTER TABLE '.$this->table.' change '.$changeAbleField.' '.current($syntaxList).'  '.implode(' ', array_splice($syntaxList, 1)).' '.$placeList;
97 97
             }
98
-            else{
98
+            else {
99 99
                 $alterSytanx = 'ALTER TABLE '.$this->table.' modify '.$syntax.' '.$placeList;
100 100
             }
101 101
 
102 102
 
103
-            $query=$this->schema->getConnection()->setQueryBasic($alterSytanx);
103
+            $query = $this->schema->getConnection()->setQueryBasic($alterSytanx);
104 104
 
105
-            if(count($this->alterExtras)){
106
-                foreach($this->alterExtras as $extra){
105
+            if (count($this->alterExtras)) {
106
+                foreach ($this->alterExtras as $extra) {
107 107
 
108 108
                     $extraSyntax = 'ALTER TABLE '.$this->table.' '.$extra.'';
109 109
 
110
-                    $query=$this->schema->getConnection()->setQueryBasic($extraSyntax);
110
+                    $query = $this->schema->getConnection()->setQueryBasic($extraSyntax);
111 111
                 }
112 112
             }
113 113
 
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
      */
130 130
     private function dropColumn($alterType)
131 131
     {
132
-        if(isset($this->syntax[0])){
132
+        if (isset($this->syntax[0])) {
133 133
 
134 134
             $column = rtrim($this->syntax[0]);
135 135
 
136 136
             $alterSytanx = 'alter table '.$this->table.' drop column '.$column;
137 137
 
138
-            $query=$this->schema->getConnection()->setQueryBasic($alterSytanx);
138
+            $query = $this->schema->getConnection()->setQueryBasic($alterSytanx);
139 139
 
140 140
             return [
141 141
                 'syntax'=>$this->syntax,
@@ -162,32 +162,32 @@  discard block
 block discarded – undo
162 162
 
163 163
         $this->getDefaultSyntaxGroup();
164 164
 
165
-        $this->syntax[]=')';
165
+        $this->syntax[] = ')';
166 166
 
167 167
         //get table collation
168
-        if(isset($this->data['tableCollation']['table'])){
169
-            $this->syntax[]=' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table'];
168
+        if (isset($this->data['tableCollation']['table'])) {
169
+            $this->syntax[] = ' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table'];
170 170
         }
171
-        else{
172
-            $this->syntax[]=' DEFAULT CHARACTER SET utf8';
171
+        else {
172
+            $this->syntax[] = ' DEFAULT CHARACTER SET utf8';
173 173
         }
174 174
 
175 175
         //get engine
176
-        if($this->data['engine']!==null)
176
+        if ($this->data['engine']!==null)
177 177
         {
178
-            $this->syntax[]=' ENGINE='.$this->data['engine'].' ';
178
+            $this->syntax[] = ' ENGINE='.$this->data['engine'].' ';
179 179
         }
180
-        else{
181
-            $this->syntax[]=' ENGINE=InnoDB ';
180
+        else {
181
+            $this->syntax[] = ' ENGINE=InnoDB ';
182 182
         }
183 183
 
184
-        $syntax = implode("",$this->syntax);
184
+        $syntax = implode("", $this->syntax);
185 185
 
186
-        if(in_array($this->table,$existTables)){
186
+        if (in_array($this->table, $existTables)) {
187 187
             return false;
188 188
         }
189
-        else{
190
-            $query=$this->schema->getConnection()->setQueryBasic($syntax);
189
+        else {
190
+            $query = $this->schema->getConnection()->setQueryBasic($syntax);
191 191
 
192 192
             return [
193 193
                 'syntax'=>$syntax,
@@ -202,41 +202,41 @@  discard block
 block discarded – undo
202 202
     /**
203 203
      * @param null $group
204 204
      */
205
-    private function getDefaultSyntaxGroup($group=null)
205
+    private function getDefaultSyntaxGroup($group = null)
206 206
     {
207
-        $this->syntax[]=implode(",",$this->getCreateDefaultList());
207
+        $this->syntax[] = implode(",", $this->getCreateDefaultList());
208 208
         
209 209
         //get unique values
210
-        if(isset($this->data['uniqueValueList']) && count($this->data['uniqueValueList'])){
210
+        if (isset($this->data['uniqueValueList']) && count($this->data['uniqueValueList'])) {
211 211
             
212
-            if($group=='create'){
213
-                $this->syntax[]=','.implode(',',$this->data['uniqueValueList']);
212
+            if ($group=='create') {
213
+                $this->syntax[] = ','.implode(',', $this->data['uniqueValueList']);
214 214
             }
215
-            else{
216
-                $this->alterExtras[]='ADD '.implode(',',$this->data['uniqueValueList']);
215
+            else {
216
+                $this->alterExtras[] = 'ADD '.implode(',', $this->data['uniqueValueList']);
217 217
             }
218 218
             
219 219
         }
220 220
 
221 221
         //get index values
222
-        if(isset($this->data['indexValueList']) && count($this->data['indexValueList'])){
222
+        if (isset($this->data['indexValueList']) && count($this->data['indexValueList'])) {
223 223
 
224
-            if($group=='create'){
225
-                $this->syntax[]=','.implode(',',$this->data['indexValueList']);
224
+            if ($group=='create') {
225
+                $this->syntax[] = ','.implode(',', $this->data['indexValueList']);
226 226
             }
227
-            else{
228
-                $this->alterExtras[]='ADD '.implode(',',$this->data['indexValueList']); 
227
+            else {
228
+                $this->alterExtras[] = 'ADD '.implode(',', $this->data['indexValueList']); 
229 229
             }
230 230
             
231 231
         }
232 232
 
233 233
         //get index values for key
234
-        if(count($this->getKeyList())){
235
-            $this->syntax[]=','.implode(',',$this->getKeyList());
234
+        if (count($this->getKeyList())) {
235
+            $this->syntax[] = ','.implode(',', $this->getKeyList());
236 236
         }
237 237
 
238
-        if(count($this->data['references'])){
239
-            $this->syntax[]=$this->getReferenceSyntax($this->data['references']);
238
+        if (count($this->data['references'])) {
239
+            $this->syntax[] = $this->getReferenceSyntax($this->data['references']);
240 240
         }
241 241
     }
242 242
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -94,8 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
             if(current($syntaxList)!==$changeAbleField){
96 96
                 $alterSytanx = 'ALTER TABLE '.$this->table.' change '.$changeAbleField.' '.current($syntaxList).'  '.implode(' ',array_splice($syntaxList,1)).' '.$placeList;
97
-            }
98
-            else{
97
+            } else{
99 98
                 $alterSytanx = 'ALTER TABLE '.$this->table.' modify '.$syntax.' '.$placeList;
100 99
             }
101 100
 
@@ -167,8 +166,7 @@  discard block
 block discarded – undo
167 166
         //get table collation
168 167
         if(isset($this->data['tableCollation']['table'])){
169 168
             $this->syntax[]=' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table'];
170
-        }
171
-        else{
169
+        } else{
172 170
             $this->syntax[]=' DEFAULT CHARACTER SET utf8';
173 171
         }
174 172
 
@@ -176,8 +174,7 @@  discard block
 block discarded – undo
176 174
         if($this->data['engine']!==null)
177 175
         {
178 176
             $this->syntax[]=' ENGINE='.$this->data['engine'].' ';
179
-        }
180
-        else{
177
+        } else{
181 178
             $this->syntax[]=' ENGINE=InnoDB ';
182 179
         }
183 180
 
@@ -185,8 +182,7 @@  discard block
 block discarded – undo
185 182
 
186 183
         if(in_array($this->table,$existTables)){
187 184
             return false;
188
-        }
189
-        else{
185
+        } else{
190 186
             $query=$this->schema->getConnection()->setQueryBasic($syntax);
191 187
 
192 188
             return [
@@ -211,8 +207,7 @@  discard block
 block discarded – undo
211 207
             
212 208
             if($group=='create'){
213 209
                 $this->syntax[]=','.implode(',',$this->data['uniqueValueList']);
214
-            }
215
-            else{
210
+            } else{
216 211
                 $this->alterExtras[]='ADD '.implode(',',$this->data['uniqueValueList']);
217 212
             }
218 213
             
@@ -223,8 +218,7 @@  discard block
 block discarded – undo
223 218
 
224 219
             if($group=='create'){
225 220
                 $this->syntax[]=','.implode(',',$this->data['indexValueList']);
226
-            }
227
-            else{
221
+            } else{
228 222
                 $this->alterExtras[]='ADD '.implode(',',$this->data['indexValueList']); 
229 223
             }
230 224
             
Please login to merge, or discard this patch.
resta/Database/Migration/Src/GrammarStructure/Mysql/Wizard/WizardAlter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use Migratio\Contract\WizardContract;
6 6
 use Migratio\Contract\WizardAlterContract;
7 7
 
8
-class WizardAlter extends Wizard implements WizardContract,WizardAlterContract
8
+class WizardAlter extends Wizard implements WizardContract, WizardAlterContract
9 9
 {
10 10
     /**
11 11
      * @var array
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function after($field)
34 34
     {
35
-        $this->wizard->setAlterType('place',['AFTER'=>$field]);
35
+        $this->wizard->setAlterType('place', ['AFTER'=>$field]);
36 36
 
37 37
         return $this->wizard;
38 38
     }
Please login to merge, or discard this patch.