Test Setup Failed
Push — master ( 7e4be1...55ee1d )
by Php Easy Api
04:25
created
src/resta/Database/Migration/Src/Resource/PullManager/Pulling.php 2 patches
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,42 +49,42 @@  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
                 
81 81
                 $this->schema->getConnection()->generateEntity($dbtable);
82 82
                 echo $dbtablekey.'- '.$migrationName.' ---> Ok';
83 83
             }
84
-            elseif($exist){
84
+            elseif ($exist) {
85 85
                 echo $dbtablekey.'- '.$migrationName.' ---> (Already Exist)';
86 86
             }
87
-            else{
87
+            else {
88 88
                 echo $dbtablekey.'- '.$migrationName.' ---> Fail';
89 89
             }
90 90
 
@@ -112,46 +112,46 @@  discard block
 block discarded – undo
112 112
 
113 113
         $list = [];
114 114
 
115
-        foreach ($columns as $key=>$data){
115
+        foreach ($columns as $key=>$data) {
116 116
 
117
-            $data['Type'] = rtrim(str_replace('unsigned','',$data['Type']));
117
+            $data['Type'] = rtrim(str_replace('unsigned', '', $data['Type']));
118 118
 
119 119
             $field      = $data['Field'];
120 120
             $list[]     = '$wizard->name(\''.$field.'\')';
121 121
             $list[]     = '->'.$this->getColumnTransformers($data['Type']).'';
122 122
 
123 123
             //default block
124
-            if(!is_null($data['Default'])){
124
+            if (!is_null($data['Default'])) {
125 125
                 $default = $data['Default'];
126
-                $list[]     = '->default(\''.$default.'\')';
126
+                $list[] = '->default(\''.$default.'\')';
127 127
             }
128 128
 
129
-            $getIndex = $this->getIndexInformation($indexes,$data['Field']);
129
+            $getIndex = $this->getIndexInformation($indexes, $data['Field']);
130 130
 
131 131
             //unique block
132
-            if($getIndex['Non_unique']=='0' && $getIndex['Key_name']!=='PRIMARY'){
132
+            if ($getIndex['Non_unique']=='0' && $getIndex['Key_name']!=='PRIMARY') {
133 133
                 $indexName = $getIndex['Key_name'];
134
-                $list[]     = '->unique(\''.$indexName.'\')';
134
+                $list[] = '->unique(\''.$indexName.'\')';
135 135
             }
136 136
 
137 137
             //index block
138
-            if($getIndex['Non_unique']=='1' && $getIndex['Key_name']!=='PRIMARY'){
138
+            if ($getIndex['Non_unique']=='1' && $getIndex['Key_name']!=='PRIMARY') {
139 139
                 $columnName = $getIndex['Column_name'];
140 140
                 $indexName = $getIndex['Key_name'];
141 141
 
142
-                if(count($multipleIndexes[$indexName])==1){
142
+                if (count($multipleIndexes[$indexName])==1) {
143 143
                     $list[] = '->index(\''.$indexName.'\')';
144 144
                 }
145 145
             }
146 146
 
147 147
             //comment block
148
-            if(strlen($data['Comment'])>0){
148
+            if (strlen($data['Comment'])>0) {
149 149
                 $comment = $data['Comment'];
150 150
                 $list[] = '->comment(\''.$comment.'\')';
151 151
             }
152 152
 
153 153
             //auto increment block
154
-            if($data['Extra']=='auto_increment'){
154
+            if ($data['Extra']=='auto_increment') {
155 155
                 $list[] = '->auto_increment()';
156 156
             }
157 157
 
@@ -166,39 +166,39 @@  discard block
 block discarded – undo
166 166
 
167 167
         //table indexes
168 168
         foreach ($multipleIndexes as $indexName=>$values) {
169
-            if(count($values)>1){
170
-                $values = '\''.implode('\',\'',$values).'\'';
169
+            if (count($values)>1) {
170
+                $values = '\''.implode('\',\'', $values).'\'';
171 171
                 $list[] = '    $wizard->table()->indexes(\''.$indexName.'\',['.$values.']);
172 172
                 ';
173 173
             }
174 174
         }
175 175
 
176
-        if(count($foreignKeys)){
176
+        if (count($foreignKeys)) {
177 177
 
178 178
             $constraintName = $foreignKeys['CONSTRAINT_NAME'];
179 179
             $key = $foreignKeys['COLUMN_NAME'];
180 180
             $referenceTable = $foreignKeys['REFERENCED_TABLE_NAME'];
181 181
             $referenceColumn = $foreignKeys['REFERENCED_COLUMN_NAME'];
182 182
 
183
-            if($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT'){
183
+            if ($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT') {
184 184
                 $list[] = '    $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\');
185 185
                 ';
186 186
             }
187 187
 
188
-            if($foreignKeys['UPDATE_RULE']!=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT'){
188
+            if ($foreignKeys['UPDATE_RULE']!=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT') {
189 189
                 $rule = $foreignKeys['UPDATE_RULE'];
190 190
                 $list[] = '    $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\')->onUpdate()->'.strtolower($rule).'();
191 191
                 ';
192 192
             }
193 193
 
194
-            if($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']!=='RESTRICT'){
194
+            if ($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']!=='RESTRICT') {
195 195
                 $rule = $foreignKeys['DELETE_RULE'];
196 196
                 $list[] = '    $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\')->onDelete()->'.strtolower($rule).'();
197 197
                 ';
198 198
             }
199 199
         }
200 200
 
201
-        return implode('',$list);
201
+        return implode('', $list);
202 202
     }
203 203
 
204 204
     /**
@@ -209,43 +209,43 @@  discard block
 block discarded – undo
209 209
      */
210 210
     private function getColumnTransformers($column)
211 211
     {
212
-        if($column=='datetime'){
212
+        if ($column=='datetime') {
213 213
             return 'datetime()';
214 214
         }
215
-        elseif($column=='longtext'){
215
+        elseif ($column=='longtext') {
216 216
             return 'longtext()';
217 217
         }
218
-        elseif($column=='date'){
218
+        elseif ($column=='date') {
219 219
             return 'date()';
220 220
         }
221
-        elseif($column=='text'){
221
+        elseif ($column=='text') {
222 222
             return 'text()';
223 223
         }
224
-        elseif($column=='timestamp'){
224
+        elseif ($column=='timestamp') {
225 225
             return 'timestamp()';
226 226
         }
227
-        elseif($column=='mediumint'){
227
+        elseif ($column=='mediumint') {
228 228
             return 'mediumint()';
229 229
         }
230
-        elseif($column=='tinyint'){
230
+        elseif ($column=='tinyint') {
231 231
             return 'tinyint()';
232 232
         }
233
-        elseif($column=='float'){
233
+        elseif ($column=='float') {
234 234
             return 'float()';
235 235
         }
236
-        elseif($column=='mediumtext'){
236
+        elseif ($column=='mediumtext') {
237 237
             return 'mediumtext()';
238 238
         }
239
-        elseif($column=='mediumblob'){
239
+        elseif ($column=='mediumblob') {
240 240
             return 'mediumblob()';
241 241
         }
242
-        elseif($column=='blob'){
242
+        elseif ($column=='blob') {
243 243
             return 'blob()';
244 244
         }
245
-        elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){
245
+        elseif (preg_match('@enum.*\((.*?)\)@', $column, $enum)) {
246 246
             return 'enum(['.$enum[1].'])';
247 247
         }
248
-        else{
248
+        else {
249 249
             return $column;
250 250
         }
251 251
     }
@@ -257,11 +257,11 @@  discard block
 block discarded – undo
257 257
      * @param $field
258 258
      * @return void|mixed
259 259
      */
260
-    private function getIndexInformation($index,$field)
260
+    private function getIndexInformation($index, $field)
261 261
     {
262 262
         foreach ($index as $key=>$item) {
263 263
 
264
-            if($item['Column_name'] == $field){
264
+            if ($item['Column_name']==$field) {
265 265
                 return $index[$key];
266 266
             }
267 267
         }
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
     {
280 280
         $arguments = $this->schema->getArguments();
281 281
         
282
-        $only = explode(',',$arguments['only']);
282
+        $only = explode(',', $arguments['only']);
283 283
         
284 284
         $list = [];
285 285
         
286
-        foreach($only as $table){
286
+        foreach ($only as $table) {
287 287
             
288
-            if(in_array($table,$tables) || in_array($table = strtolower($table),$tables)){
288
+            if (in_array($table, $tables) || in_array($table = strtolower($table), $tables)) {
289 289
                 $list[] = $table;
290 290
             }
291 291
         }
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     {
305 305
         $list = [];
306 306
         foreach ($index as $key=>$item) {
307
-            if($item['Non_unique']==1 && $item['Key_name']!=='PRIMARY'){
307
+            if ($item['Non_unique']==1 && $item['Key_name']!=='PRIMARY') {
308 308
                 $list[$item['Key_name']][] = $item['Column_name'];
309 309
             }
310 310
         }
Please login to merge, or discard this patch.
Braces   +16 added lines, -32 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@  discard block
 block discarded – undo
52 52
             if(!file_exists($makeDirectory)){
53 53
                 files()->makeDirectory($makeDirectory,0755,true);
54 54
                 $exist=false;
55
-            }
56
-            else{
55
+            } else{
57 56
                 $exist=true;
58 57
             }
59 58
 
@@ -71,8 +70,7 @@  discard block
 block discarded – undo
71 70
 
72 71
             if(substr($dbtable,-1)=='s'){
73 72
                 app()->command('model create','model:'.strtolower(substr($dbtable,0,-1)).' table:'.$dbtable);
74
-            }
75
-            else{
73
+            } else{
76 74
                 app()->command('model create','model:'.strtolower($dbtable).' table:'.$dbtable);
77 75
             }
78 76
 
@@ -80,11 +78,9 @@  discard block
 block discarded – undo
80 78
                 
81 79
                 $this->schema->getConnection()->generateEntity($dbtable);
82 80
                 echo $dbtablekey.'- '.$migrationName.' ---> Ok';
83
-            }
84
-            elseif($exist){
81
+            } elseif($exist){
85 82
                 echo $dbtablekey.'- '.$migrationName.' ---> (Already Exist)';
86
-            }
87
-            else{
83
+            } else{
88 84
                 echo $dbtablekey.'- '.$migrationName.' ---> Fail';
89 85
             }
90 86
 
@@ -211,41 +207,29 @@  discard block
 block discarded – undo
211 207
     {
212 208
         if($column=='datetime'){
213 209
             return 'datetime()';
214
-        }
215
-        elseif($column=='longtext'){
210
+        } elseif($column=='longtext'){
216 211
             return 'longtext()';
217
-        }
218
-        elseif($column=='date'){
212
+        } elseif($column=='date'){
219 213
             return 'date()';
220
-        }
221
-        elseif($column=='text'){
214
+        } elseif($column=='text'){
222 215
             return 'text()';
223
-        }
224
-        elseif($column=='timestamp'){
216
+        } elseif($column=='timestamp'){
225 217
             return 'timestamp()';
226
-        }
227
-        elseif($column=='mediumint'){
218
+        } elseif($column=='mediumint'){
228 219
             return 'mediumint()';
229
-        }
230
-        elseif($column=='tinyint'){
220
+        } elseif($column=='tinyint'){
231 221
             return 'tinyint()';
232
-        }
233
-        elseif($column=='float'){
222
+        } elseif($column=='float'){
234 223
             return 'float()';
235
-        }
236
-        elseif($column=='mediumtext'){
224
+        } elseif($column=='mediumtext'){
237 225
             return 'mediumtext()';
238
-        }
239
-        elseif($column=='mediumblob'){
226
+        } elseif($column=='mediumblob'){
240 227
             return 'mediumblob()';
241
-        }
242
-        elseif($column=='blob'){
228
+        } elseif($column=='blob'){
243 229
             return 'blob()';
244
-        }
245
-        elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){
230
+        } elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){
246 231
             return 'enum(['.$enum[1].'])';
247
-        }
248
-        else{
232
+        } else{
249 233
             return $column;
250 234
         }
251 235
     }
Please login to merge, or discard this patch.
src/resta/Database/Migration/Src/Resource/PushManager/PushingProcess.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,30 +14,30 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public function processHandler()
16 16
     {
17
-        return $this->errorHandler(function(){
17
+        return $this->errorHandler(function() {
18 18
             
19 19
             $results = [];
20 20
             
21
-            foreach ($this->list as $table =>$datas){
21
+            foreach ($this->list as $table =>$datas) {
22 22
 
23
-                foreach ($datas as $data){
23
+                foreach ($datas as $data) {
24 24
                     
25
-                    $query = $this->queryBuilder($table,$data);
25
+                    $query = $this->queryBuilder($table, $data);
26 26
 
27 27
                     $query = $query->handle();
28 28
                     
29 29
                     
30
-                    if($query===false){
30
+                    if ($query===false) {
31 31
                         $results[] = [];
32 32
                     }
33
-                    else{
34
-                        $status =($query['result']!==false) ? true : false;
33
+                    else {
34
+                        $status = ($query['result']!==false) ? true : false;
35 35
                         
36
-                        if($status){
36
+                        if ($status) {
37 37
                             $this->schema->getConnection()->generateEntity($table);
38 38
                         }
39 39
 
40
-                        $results[]= [
40
+                        $results[] = [
41 41
                             'success'=>$status,
42 42
                             'file'=>$data->getFile(),
43 43
                             'table'=>$table,
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
             {
68 68
                 $alterBinds = $object->getAlterBinds();
69 69
                 
70
-                if(!is_null($alterBinds) && count($alterBinds)>1){
70
+                if (!is_null($alterBinds) && count($alterBinds)>1) {
71 71
                     exception()->runtime('Only one command can be applied to alter groups');
72 72
                 }
73 73
                 
74
-                if(count($object->getError())){
74
+                if (count($object->getError())) {
75 75
                     exception()->runtime(''.$object->getFile().' -> '.$object->getError()[0].'');
76 76
                 }
77 77
                 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@
 block discarded – undo
29 29
                     
30 30
                     if($query===false){
31 31
                         $results[] = [];
32
-                    }
33
-                    else{
32
+                    } else{
34 33
                         $status =($query['result']!==false) ? true : false;
35 34
                         
36 35
                         if($status){
Please login to merge, or discard this patch.
resta/Database/Migration/Src/GrammarStructure/Mysql/Traits/QueryStack.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $collation = $this->connection()->query('SHOW COLLATION LIKE \''.$collation.'%\'')->fetchAll();
52 52
 
53
-        if(isset($collation[0])){
53
+        if (isset($collation[0])) {
54 54
             return $collation[0]['Charset'];
55 55
         }
56 56
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $status = $this->connection()->query('show table status like \''.$table.'\'')->fetchAll();
69 69
 
70
-        if(isset($status[0])){
70
+        if (isset($status[0])) {
71 71
             return $status[0];
72 72
         }
73 73
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         WHERE rc.CONSTRAINT_SCHEMA = \''.$database.'\'
104 104
         AND rc.TABLE_NAME = \''.$table.'\' AND r.REFERENCED_TABLE_NAME is not null')->fetchAll();
105 105
 
106
-        if(isset($query[0])){
106
+        if (isset($query[0])) {
107 107
             return $query[0];
108 108
         }
109 109
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         try {
122 122
 
123
-            $query =$this->connection()->query($query);
123
+            $query = $this->connection()->query($query);
124 124
 
125 125
             return [
126 126
                 'result'=>true,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                 'message'=>null,
129 129
             ];
130 130
         }
131
-        catch (\PDOException $exception){
131
+        catch (\PDOException $exception) {
132 132
 
133 133
             return [
134 134
                 'result'=>false,
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public function generateEntity($table)
146 146
     {
147
-        if(in_array($table,$this->showTables()) || in_array($table = strtolower($table),$this->showTables())){
147
+        if (in_array($table, $this->showTables()) || in_array($table = strtolower($table), $this->showTables())) {
148 148
             
149 149
             $entityDirectory = path()->model().''.DIRECTORY_SEPARATOR.'Entity';
150 150
 
151
-            if(!file_exists($entityDirectory)){
151
+            if (!file_exists($entityDirectory)) {
152 152
                 files()->makeDirectory($entityDirectory);
153 153
             }
154 154
 
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
                 $list[] = $column['Field'];
161 161
             }
162 162
 
163
-            if(!file_exists($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table))){
164
-                $generator = new Generator($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table),$table.'');
163
+            if (!file_exists($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table))) {
164
+                $generator = new Generator($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table), $table.'');
165 165
 
166 166
                 $generator->createClass();
167 167
             }
@@ -170,15 +170,15 @@  discard block
 block discarded – undo
170 170
             $abstractClassPath = $entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table).''.DIRECTORY_SEPARATOR.'Entity';
171 171
             $abstractNamespace = Utils::getNamespace($abstractClassPath.''.DIRECTORY_SEPARATOR.''.ucfirst($table).'Abstract');
172 172
 
173
-            $generator->createClassExtend($abstractNamespace,ucfirst($table).'Abstract');
173
+            $generator->createClassExtend($abstractNamespace, ucfirst($table).'Abstract');
174 174
 
175
-            $generator = new Generator($abstractClassPath,$table.'Abstract');
175
+            $generator = new Generator($abstractClassPath, $table.'Abstract');
176 176
 
177 177
             $generator->createClass();
178 178
 
179
-            $method =array_merge([
179
+            $method = array_merge([
180 180
                 '__construct'
181
-            ],array_merge($list,['__get']));
181
+            ], array_merge($list, ['__get']));
182 182
 
183 183
             $generator->createMethod($method);
184 184
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
             $generator->createClassDocument($createClassDocument);
205 205
 
206
-            $generator->createMethodDocument(array_merge($createMethodDocument,[
206
+            $generator->createMethodDocument(array_merge($createMethodDocument, [
207 207
                 '__construct' => [
208 208
                     ''.$table.' constructor.',
209 209
                     '@param null|object $query'
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
             $createMethodBody = array_merge([
220 220
                 '__construct' => 'self::$query = $query;',
221 221
                 '__get' => 'return static::{$name}();'
222
-            ],$methodBodyList);
222
+            ], $methodBodyList);
223 223
 
224 224
             $generator->createMethodBody($createMethodBody);
225 225
 
Please login to merge, or discard this patch.