Test Setup Failed
Push — master ( 04f206...334589 )
by Php Easy Api
03:51
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,45 +49,45 @@  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 72
             
73 73
 
74
-            if(isset($contentResult) && $contentResult!==false){
74
+            if (isset($contentResult) && $contentResult!==false) {
75 75
                 
76 76
                 $this->schema->getConnection()->generateEntity($dbtable);
77 77
 
78
-                if(substr($dbtable,-1)=='s'){
79
-                    app()->command('model create','model:'.strtolower(substr($dbtable,0,-1)).' table:'.$dbtable.' entity:'.$dbtable);
78
+                if (substr($dbtable, -1)=='s') {
79
+                    app()->command('model create', 'model:'.strtolower(substr($dbtable, 0, -1)).' table:'.$dbtable.' entity:'.$dbtable);
80 80
                 }
81
-                else{
82
-                    app()->command('model create','model:'.strtolower($dbtable).' table:'.$dbtable.' entity:'.$dbtable);
81
+                else {
82
+                    app()->command('model create', 'model:'.strtolower($dbtable).' table:'.$dbtable.' entity:'.$dbtable);
83 83
                 }
84 84
                 
85 85
                 echo $dbtablekey.'- '.$migrationName.' ---> Ok';
86 86
             }
87
-            elseif($exist){
87
+            elseif ($exist) {
88 88
                 echo $dbtablekey.'- '.$migrationName.' ---> (Already Exist)';
89 89
             }
90
-            else{
90
+            else {
91 91
                 echo $dbtablekey.'- '.$migrationName.' ---> Fail';
92 92
             }
93 93
 
@@ -115,46 +115,46 @@  discard block
 block discarded – undo
115 115
 
116 116
         $list = [];
117 117
 
118
-        foreach ($columns as $key=>$data){
118
+        foreach ($columns as $key=>$data) {
119 119
 
120
-            $data['Type'] = rtrim(str_replace('unsigned','',$data['Type']));
120
+            $data['Type'] = rtrim(str_replace('unsigned', '', $data['Type']));
121 121
 
122 122
             $field      = $data['Field'];
123 123
             $list[]     = '$wizard->name(\''.$field.'\')';
124 124
             $list[]     = '->'.$this->getColumnTransformers($data['Type']).'';
125 125
 
126 126
             //default block
127
-            if(!is_null($data['Default'])){
127
+            if (!is_null($data['Default'])) {
128 128
                 $default = $data['Default'];
129
-                $list[]     = '->default(\''.$default.'\')';
129
+                $list[] = '->default(\''.$default.'\')';
130 130
             }
131 131
 
132
-            $getIndex = $this->getIndexInformation($indexes,$data['Field']);
132
+            $getIndex = $this->getIndexInformation($indexes, $data['Field']);
133 133
 
134 134
             //unique block
135
-            if($getIndex['Non_unique']=='0' && $getIndex['Key_name']!=='PRIMARY'){
135
+            if ($getIndex['Non_unique']=='0' && $getIndex['Key_name']!=='PRIMARY') {
136 136
                 $indexName = $getIndex['Key_name'];
137
-                $list[]     = '->unique(\''.$indexName.'\')';
137
+                $list[] = '->unique(\''.$indexName.'\')';
138 138
             }
139 139
 
140 140
             //index block
141
-            if($getIndex['Non_unique']=='1' && $getIndex['Key_name']!=='PRIMARY'){
141
+            if ($getIndex['Non_unique']=='1' && $getIndex['Key_name']!=='PRIMARY') {
142 142
                 $columnName = $getIndex['Column_name'];
143 143
                 $indexName = $getIndex['Key_name'];
144 144
 
145
-                if(count($multipleIndexes[$indexName])==1){
145
+                if (count($multipleIndexes[$indexName])==1) {
146 146
                     $list[] = '->index(\''.$indexName.'\')';
147 147
                 }
148 148
             }
149 149
 
150 150
             //comment block
151
-            if(strlen($data['Comment'])>0){
151
+            if (strlen($data['Comment'])>0) {
152 152
                 $comment = $data['Comment'];
153 153
                 $list[] = '->comment(\''.$comment.'\')';
154 154
             }
155 155
 
156 156
             //auto increment block
157
-            if($data['Extra']=='auto_increment'){
157
+            if ($data['Extra']=='auto_increment') {
158 158
                 $list[] = '->auto_increment()';
159 159
             }
160 160
 
@@ -169,39 +169,39 @@  discard block
 block discarded – undo
169 169
 
170 170
         //table indexes
171 171
         foreach ($multipleIndexes as $indexName=>$values) {
172
-            if(count($values)>1){
173
-                $values = '\''.implode('\',\'',$values).'\'';
172
+            if (count($values)>1) {
173
+                $values = '\''.implode('\',\'', $values).'\'';
174 174
                 $list[] = '    $wizard->table()->indexes(\''.$indexName.'\',['.$values.']);
175 175
                 ';
176 176
             }
177 177
         }
178 178
 
179
-        if(count($foreignKeys)){
179
+        if (count($foreignKeys)) {
180 180
 
181 181
             $constraintName = $foreignKeys['CONSTRAINT_NAME'];
182 182
             $key = $foreignKeys['COLUMN_NAME'];
183 183
             $referenceTable = $foreignKeys['REFERENCED_TABLE_NAME'];
184 184
             $referenceColumn = $foreignKeys['REFERENCED_COLUMN_NAME'];
185 185
 
186
-            if($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT'){
186
+            if ($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT') {
187 187
                 $list[] = '    $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\');
188 188
                 ';
189 189
             }
190 190
 
191
-            if($foreignKeys['UPDATE_RULE']!=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT'){
191
+            if ($foreignKeys['UPDATE_RULE']!=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT') {
192 192
                 $rule = $foreignKeys['UPDATE_RULE'];
193 193
                 $list[] = '    $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\')->onUpdate()->'.strtolower($rule).'();
194 194
                 ';
195 195
             }
196 196
 
197
-            if($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']!=='RESTRICT'){
197
+            if ($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']!=='RESTRICT') {
198 198
                 $rule = $foreignKeys['DELETE_RULE'];
199 199
                 $list[] = '    $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\')->onDelete()->'.strtolower($rule).'();
200 200
                 ';
201 201
             }
202 202
         }
203 203
 
204
-        return implode('',$list);
204
+        return implode('', $list);
205 205
     }
206 206
 
207 207
     /**
@@ -212,43 +212,43 @@  discard block
 block discarded – undo
212 212
      */
213 213
     private function getColumnTransformers($column)
214 214
     {
215
-        if($column=='datetime'){
215
+        if ($column=='datetime') {
216 216
             return 'datetime()';
217 217
         }
218
-        elseif($column=='longtext'){
218
+        elseif ($column=='longtext') {
219 219
             return 'longtext()';
220 220
         }
221
-        elseif($column=='date'){
221
+        elseif ($column=='date') {
222 222
             return 'date()';
223 223
         }
224
-        elseif($column=='text'){
224
+        elseif ($column=='text') {
225 225
             return 'text()';
226 226
         }
227
-        elseif($column=='timestamp'){
227
+        elseif ($column=='timestamp') {
228 228
             return 'timestamp()';
229 229
         }
230
-        elseif($column=='mediumint'){
230
+        elseif ($column=='mediumint') {
231 231
             return 'mediumint()';
232 232
         }
233
-        elseif($column=='tinyint'){
233
+        elseif ($column=='tinyint') {
234 234
             return 'tinyint()';
235 235
         }
236
-        elseif($column=='float'){
236
+        elseif ($column=='float') {
237 237
             return 'float()';
238 238
         }
239
-        elseif($column=='mediumtext'){
239
+        elseif ($column=='mediumtext') {
240 240
             return 'mediumtext()';
241 241
         }
242
-        elseif($column=='mediumblob'){
242
+        elseif ($column=='mediumblob') {
243 243
             return 'mediumblob()';
244 244
         }
245
-        elseif($column=='blob'){
245
+        elseif ($column=='blob') {
246 246
             return 'blob()';
247 247
         }
248
-        elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){
248
+        elseif (preg_match('@enum.*\((.*?)\)@', $column, $enum)) {
249 249
             return 'enum(['.$enum[1].'])';
250 250
         }
251
-        else{
251
+        else {
252 252
             return $column;
253 253
         }
254 254
     }
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
      * @param $field
261 261
      * @return void|mixed
262 262
      */
263
-    private function getIndexInformation($index,$field)
263
+    private function getIndexInformation($index, $field)
264 264
     {
265 265
         foreach ($index as $key=>$item) {
266 266
 
267
-            if($item['Column_name'] == $field){
267
+            if ($item['Column_name']==$field) {
268 268
                 return $index[$key];
269 269
             }
270 270
         }
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
     {
283 283
         $arguments = $this->schema->getArguments();
284 284
         
285
-        $only = explode(',',$arguments['only']);
285
+        $only = explode(',', $arguments['only']);
286 286
         
287 287
         $list = [];
288 288
         
289
-        foreach($only as $table){
289
+        foreach ($only as $table) {
290 290
             
291
-            if(in_array($table,$tables) || in_array($table = strtolower($table),$tables)){
291
+            if (in_array($table, $tables) || in_array($table = strtolower($table), $tables)) {
292 292
                 $list[] = $table;
293 293
             }
294 294
         }
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     {
308 308
         $list = [];
309 309
         foreach ($index as $key=>$item) {
310
-            if($item['Non_unique']==1 && $item['Key_name']!=='PRIMARY'){
310
+            if ($item['Non_unique']==1 && $item['Key_name']!=='PRIMARY') {
311 311
                 $list[$item['Key_name']][] = $item['Column_name'];
312 312
             }
313 313
         }
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
 
@@ -77,17 +76,14 @@  discard block
 block discarded – undo
77 76
 
78 77
                 if(substr($dbtable,-1)=='s'){
79 78
                     app()->command('model create','model:'.strtolower(substr($dbtable,0,-1)).' table:'.$dbtable.' entity:'.$dbtable);
80
-                }
81
-                else{
79
+                } else{
82 80
                     app()->command('model create','model:'.strtolower($dbtable).' table:'.$dbtable.' entity:'.$dbtable);
83 81
                 }
84 82
                 
85 83
                 echo $dbtablekey.'- '.$migrationName.' ---> Ok';
86
-            }
87
-            elseif($exist){
84
+            } elseif($exist){
88 85
                 echo $dbtablekey.'- '.$migrationName.' ---> (Already Exist)';
89
-            }
90
-            else{
86
+            } else{
91 87
                 echo $dbtablekey.'- '.$migrationName.' ---> Fail';
92 88
             }
93 89
 
@@ -214,41 +210,29 @@  discard block
 block discarded – undo
214 210
     {
215 211
         if($column=='datetime'){
216 212
             return 'datetime()';
217
-        }
218
-        elseif($column=='longtext'){
213
+        } elseif($column=='longtext'){
219 214
             return 'longtext()';
220
-        }
221
-        elseif($column=='date'){
215
+        } elseif($column=='date'){
222 216
             return 'date()';
223
-        }
224
-        elseif($column=='text'){
217
+        } elseif($column=='text'){
225 218
             return 'text()';
226
-        }
227
-        elseif($column=='timestamp'){
219
+        } elseif($column=='timestamp'){
228 220
             return 'timestamp()';
229
-        }
230
-        elseif($column=='mediumint'){
221
+        } elseif($column=='mediumint'){
231 222
             return 'mediumint()';
232
-        }
233
-        elseif($column=='tinyint'){
223
+        } elseif($column=='tinyint'){
234 224
             return 'tinyint()';
235
-        }
236
-        elseif($column=='float'){
225
+        } elseif($column=='float'){
237 226
             return 'float()';
238
-        }
239
-        elseif($column=='mediumtext'){
227
+        } elseif($column=='mediumtext'){
240 228
             return 'mediumtext()';
241
-        }
242
-        elseif($column=='mediumblob'){
229
+        } elseif($column=='mediumblob'){
243 230
             return 'mediumblob()';
244
-        }
245
-        elseif($column=='blob'){
231
+        } elseif($column=='blob'){
246 232
             return 'blob()';
247
-        }
248
-        elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){
233
+        } elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){
249 234
             return 'enum(['.$enum[1].'])';
250
-        }
251
-        else{
235
+        } else{
252 236
             return $column;
253 237
         }
254 238
     }
Please login to merge, or discard this patch.
src/resta/Database/Migration/Src/Resource/PushManager/PushingProcess.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,37 +14,37 @@  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
-                            if(substr($table,-1)=='s'){
40
-                                app()->command('model create','model:'.strtolower(substr($table,0,-1)).' table:'.$table.' entity:'.$table);
39
+                            if (substr($table, -1)=='s') {
40
+                                app()->command('model create', 'model:'.strtolower(substr($table, 0, -1)).' table:'.$table.' entity:'.$table);
41 41
                             }
42
-                            else{
43
-                                app()->command('model create','model:'.strtolower($table).' table:'.$table.' entity:'.$table);
42
+                            else {
43
+                                app()->command('model create', 'model:'.strtolower($table).' table:'.$table.' entity:'.$table);
44 44
                             }
45 45
                         }
46 46
 
47
-                        $results[]= [
47
+                        $results[] = [
48 48
                             'success'=>$status,
49 49
                             'file'=>$data->getFile(),
50 50
                             'table'=>$table,
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
             {
75 75
                 $alterBinds = $object->getAlterBinds();
76 76
                 
77
-                if(!is_null($alterBinds) && count($alterBinds)>1){
77
+                if (!is_null($alterBinds) && count($alterBinds)>1) {
78 78
                     exception()->runtime('Only one command can be applied to alter groups');
79 79
                 }
80 80
                 
81
-                if(count($object->getError())){
81
+                if (count($object->getError())) {
82 82
                     exception()->runtime(''.$object->getFile().' -> '.$object->getError()[0].'');
83 83
                 }
84 84
                 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 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){
@@ -38,8 +37,7 @@  discard block
 block discarded – undo
38 37
 
39 38
                             if(substr($table,-1)=='s'){
40 39
                                 app()->command('model create','model:'.strtolower(substr($table,0,-1)).' table:'.$table.' entity:'.$table);
41
-                            }
42
-                            else{
40
+                            } else{
43 41
                                 app()->command('model create','model:'.strtolower($table).' table:'.$table.' entity:'.$table);
44 42
                             }
45 43
                         }
Please login to merge, or discard this patch.
resta/Database/Migration/Src/GrammarStructure/Mysql/Traits/QueryStack.php 2 patches
Spacing   +18 added lines, -18 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,15 +144,15 @@  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(app()->path()->model())){
151
+            if (!file_exists(app()->path()->model())) {
152 152
                 files()->makeDirectory(app()->path()->model());
153 153
             }
154 154
 
155
-            if(!file_exists($entityDirectory)){
155
+            if (!file_exists($entityDirectory)) {
156 156
                 files()->makeDirectory($entityDirectory);
157 157
             }
158 158
 
@@ -164,27 +164,27 @@  discard block
 block discarded – undo
164 164
                 $list[] = $column['Field'];
165 165
             }
166 166
 
167
-            if(!file_exists($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table))){
168
-                $generator = new Generator($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table),$table.'');
167
+            if (!file_exists($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table))) {
168
+                $generator = new Generator($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table), $table.'');
169 169
                 $generator->createClass();
170 170
             }
171
-            else{
172
-                $generator = new Generator($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table),$table.'');
171
+            else {
172
+                $generator = new Generator($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table), $table.'');
173 173
             }
174 174
 
175 175
 
176 176
             $abstractClassPath = $entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table).''.DIRECTORY_SEPARATOR.'Entity';
177 177
             $abstractNamespace = Utils::getNamespace($abstractClassPath.''.DIRECTORY_SEPARATOR.''.ucfirst($table).'Abstract');
178 178
 
179
-            $generator->createClassExtend($abstractNamespace,ucfirst($table).'Abstract');
179
+            $generator->createClassExtend($abstractNamespace, ucfirst($table).'Abstract');
180 180
 
181
-            $generator = new Generator($abstractClassPath,$table.'Abstract');
181
+            $generator = new Generator($abstractClassPath, $table.'Abstract');
182 182
 
183 183
             $generator->createClass();
184 184
 
185
-            $method =array_merge([
185
+            $method = array_merge([
186 186
                 '__construct'
187
-            ],array_merge($list,['__get']));
187
+            ], array_merge($list, ['__get']));
188 188
 
189 189
             $generator->createMethod($method);
190 190
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
             $generator->createClassDocument($createClassDocument);
211 211
 
212
-            $generator->createMethodDocument(array_merge($createMethodDocument,[
212
+            $generator->createMethodDocument(array_merge($createMethodDocument, [
213 213
                 '__construct' => [
214 214
                     ''.$table.' constructor.',
215 215
                     '@param null|object $query'
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
             $createMethodBody = array_merge([
226 226
                 '__construct' => 'self::$query = $query;',
227 227
                 '__get' => 'return static::{$name}();'
228
-            ],$methodBodyList);
228
+            ], $methodBodyList);
229 229
 
230 230
             $generator->createMethodBody($createMethodBody);
231 231
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -127,8 +127,7 @@  discard block
 block discarded – undo
127 127
                 'query'=>$query,
128 128
                 'message'=>null,
129 129
             ];
130
-        }
131
-        catch (\PDOException $exception){
130
+        } catch (\PDOException $exception){
132 131
 
133 132
             return [
134 133
                 'result'=>false,
@@ -167,8 +166,7 @@  discard block
 block discarded – undo
167 166
             if(!file_exists($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table))){
168 167
                 $generator = new Generator($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table),$table.'');
169 168
                 $generator->createClass();
170
-            }
171
-            else{
169
+            } else{
172 170
                 $generator = new Generator($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table),$table.'');
173 171
             }
174 172
 
Please login to merge, or discard this patch.
src/resta/Support/ReflectionProcess.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function __construct($namespace = null)
42 42
     {
43
-        if($namespace!==null){
43
+        if ($namespace!==null) {
44 44
             $this->namespace = $namespace;
45 45
         }
46 46
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function getReflectionClass()
74 74
     {
75
-        if(!isset(static::$singletons['reflectionClass'])){
75
+        if (!isset(static::$singletons['reflectionClass'])) {
76 76
             static::$singletons['reflectionClass'] = new ReflectionClass($this->namespace);
77 77
         }
78 78
         return static::$singletons['reflectionClass'];
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function getReflectionMethod($method)
88 88
     {
89
-        return new ReflectionMethod($this->namespace,$method);
89
+        return new ReflectionMethod($this->namespace, $method);
90 90
     }
91 91
 
92 92
     /**
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
      *
99 99
      * @throws ReflectionException
100 100
      */
101
-    public function isAvailableMethodDocument($method=null,$param=null)
101
+    public function isAvailableMethodDocument($method = null, $param = null)
102 102
     {
103 103
         $document = $this->reflectionMethodParams($method)->document;
104 104
 
105
-        if(is_string($document)
106
-            && preg_match('#@'.$param.'\((.*?)\)\r\n#is',$document,$data)) {
105
+        if (is_string($document)
106
+            && preg_match('#@'.$param.'\((.*?)\)\r\n#is', $document, $data)) {
107 107
             if (is_array($data) && isset($data[1])) {
108 108
                 $this->documentData = $data[1];
109 109
                 return true;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function __invoke($namespace = null)
139 139
     {
140
-        if($namespace!==null){
140
+        if ($namespace!==null) {
141 141
             $this->namespace = $namespace;
142 142
         }
143 143
         return $this;
Please login to merge, or discard this patch.
src/resta/Container/ContainerResolve.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @throws \ReflectionException
25 25
      */
26
-    public function call($class,$param,callable $callback)
26
+    public function call($class, $param, callable $callback)
27 27
     {
28 28
         // We use the reflection class to solve
29 29
         // the parameters of the class's methods.
30
-        $param = $this->reflectionMethodParameters($class,$param);
30
+        $param = $this->reflectionMethodParameters($class, $param);
31 31
 
32 32
         // the results of a number of processes will be given
33 33
         // before the container pipeline method is given.
34 34
         return $this->app->resolve(ContainerPipelineResolve::class)->handle(
35
-            function() use($class,$param,$callback)
35
+            function() use($class, $param, $callback)
36 36
             {
37 37
                 // as a result
38 38
                 // we return the resolved class to the callback class
39
-                $params = (object)['class'=>$class,'param'=>$param];
40
-                return call_user_func_array($callback,[$params]);
39
+                $params = (object)['class'=>$class, 'param'=>$param];
40
+                return call_user_func_array($callback, [$params]);
41 41
             });
42 42
 
43 43
     }
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
      * @param $parameter
50 50
      * @return array
51 51
      */
52
-    private function checkParameterForContainer($containers,$parameter)
52
+    private function checkParameterForContainer($containers, $parameter)
53 53
     {
54 54
         // if the parameter is an object and
55 55
         // this object is a service container object
56 56
         // then the parameter will bind.
57
-        if($parameter->getType()!==null && isset($containers[$parameter->getType()->getName()])){
57
+        if ($parameter->getType()!==null && isset($containers[$parameter->getType()->getName()])) {
58 58
 
59 59
             // Unpack the container object and
60 60
             // bind it to the param variable.
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             return [$parameterName=>$parameterResolve];
74 74
         }
75 75
 
76
-        if($parameter->getType()!== NULL && Utils::isNamespaceExists($parameter->getType()->getName())){
76
+        if ($parameter->getType()!==NULL && Utils::isNamespaceExists($parameter->getType()->getName())) {
77 77
 
78 78
             // Unpack the container object and
79 79
             // bind it to the param variable.
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
      */
97 97
     private function getReflectionMethod($class)
98 98
     {
99
-        if(!isset($class[0],$class[1])){
99
+        if (!isset($class[0], $class[1])) {
100 100
             exception('containerResolvingMissing')
101 101
                 ->runtime('Container class resolving is missing');
102 102
         }
103 103
 
104
-        [$class,$method] = [$class[0],$class[1]];
104
+        [$class, $method] = [$class[0], $class[1]];
105 105
 
106 106
         return $this->instanceReflection($this->app['reflection']($class))
107 107
             ->reflectionMethodParams($method);
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
      * @param $instance
114 114
      * @return object|null
115 115
      */
116
-    public function instanceReflection($instance=null)
116
+    public function instanceReflection($instance = null)
117 117
     {
118
-        if(is_object($instance) && is_null(static::$reflectionInstance)){
118
+        if (is_object($instance) && is_null(static::$reflectionInstance)) {
119 119
             static::$reflectionInstance = $instance;
120 120
         }
121 121
 
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
      *
132 132
      * @throws \ReflectionException
133 133
      */
134
-    private function reflectionMethodParameters($class,$param)
134
+    private function reflectionMethodParameters($class, $param)
135 135
     {
136 136
         $containers = [];
137 137
 
138 138
         //get service container objects.
139
-        if(isset($this->app['serviceContainer'])){
139
+        if (isset($this->app['serviceContainer'])) {
140 140
             $containers = $this->app['serviceContainer'];
141 141
         }
142 142
 
@@ -148,22 +148,22 @@  discard block
 block discarded – undo
148 148
         // we provide the user with the container method document and take action.
149 149
         // thus, we help the methods to have a cleaner code structure.
150 150
         $this->app->resolve(ContainerMethodDocumentResolver::class,
151
-            ['reflection'=>$this->instanceReflection(),'class'=>$class]);
151
+            ['reflection'=>$this->instanceReflection(), 'class'=>$class]);
152 152
 
153 153
         // we group the parameters into type and
154 154
         // name and bind them with the necessary logic.
155
-        foreach ($parameters as $parameter){
155
+        foreach ($parameters as $parameter) {
156 156
 
157 157
             // if the parameter is an object and
158 158
             // this object is a service container object
159 159
             // then the parameter will bind.
160
-            $checkParameterForContainer = $this->checkParameterForContainer($containers,$parameter);
161
-            $paramMerge = array_merge($param,$checkParameterForContainer);
160
+            $checkParameterForContainer = $this->checkParameterForContainer($containers, $parameter);
161
+            $paramMerge = array_merge($param, $checkParameterForContainer);
162 162
 
163 163
             // we do some useful logic bind for user benefit.
164
-            $param = app()->resolve(GraceContainer::class,[
164
+            $param = app()->resolve(GraceContainer::class, [
165 165
                 'reflection' => $reflection->reflection
166
-            ])->graceContainerBuilder($parameter,$paramMerge);
166
+            ])->graceContainerBuilder($parameter, $paramMerge);
167 167
 
168 168
         }
169 169
 
Please login to merge, or discard this patch.
src/resta/Console/Source/Project/Project.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     /**
15 15
      * @var $type
16 16
      */
17
-    public $type='project';
17
+    public $type = 'project';
18 18
 
19 19
     /**
20 20
      * @var array
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     /**
32 32
      * @var $commandRule
33 33
      */
34
-    public $commandRule=[];
34
+    public $commandRule = [];
35 35
 
36 36
     /**
37 37
      * @method create
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
         $this->directory['projectDir']          = $this->projectPath();
47 47
         $this->argument['exceptionNamespace']   = app()->namespace()->exception();
48 48
         $this->argument['resourcePath']         = app()->path()->appResourche();
49
-        $this->argument['testNamespace']             = app()->namespace()->tests();
49
+        $this->argument['testNamespace'] = app()->namespace()->tests();
50 50
 
51
-        $recursiveDefaultDirectory = explode("\\",$this->argument['project']);
51
+        $recursiveDefaultDirectory = explode("\\", $this->argument['project']);
52 52
         $this->argument['applicationName'] = pos($recursiveDefaultDirectory);
53 53
         $recursiveDefaultDirectory[] = 'V1';
54 54
         $recursiveDefaultDirectoryList = [];
55 55
 
56
-        foreach (array_slice($recursiveDefaultDirectory,1) as $defaultDirectory){
56
+        foreach (array_slice($recursiveDefaultDirectory, 1) as $defaultDirectory) {
57 57
 
58
-            $recursiveDefaultDirectoryList[]=$defaultDirectory;
59
-            $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/",$recursiveDefaultDirectoryList);
58
+            $recursiveDefaultDirectoryList[] = $defaultDirectory;
59
+            $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/", $recursiveDefaultDirectoryList);
60 60
         }
61 61
 
62 62
         //$this->directory['optionalDir'] = $this->optional();
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         //$this->directory['sourceDir']               = $this->sourceDir();
83 83
         //$this->directory['sourceSupportDir']        = $this->sourceSupportDir();
84 84
         //$this->directory['sourceSupportTraitDir']   = $this->sourceSupportDir().'/Traits';
85
-        $this->directory['exceptionDir']            = app()->path()->exception();
85
+        $this->directory['exceptionDir'] = app()->path()->exception();
86 86
 
87 87
         //set project directory
88 88
         $this->file->makeDirectory($this);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $this->touch['app/gitignore']               = $this->projectPath().'/.gitignore';
139 139
         $this->touch['app/composer']                = $this->projectPath().'/composer.json';
140 140
         $this->touch['test/index']                  = $this->storage().'/index.html';
141
-        $this->touch['exception/authenticate']      = $this->directory['exceptionDir'] .'/AuthenticateException.php';
141
+        $this->touch['exception/authenticate']      = $this->directory['exceptionDir'].'/AuthenticateException.php';
142 142
 
143 143
         //set project touch
144 144
         $this->file->touch($this);
Please login to merge, or discard this patch.
src/resta/Cache/CacheManager.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function adapter($adapter)
62 62
     {
63
-        if(!is_null($adapter)){
63
+        if (!is_null($adapter)) {
64 64
             $this->adapter = $adapter;
65 65
         }
66 66
 
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
      * @param $cacheProvider
75 75
      * @param $data
76 76
      */
77
-    private function cacheServiceProvider($cacheItem,$cacheProvider,$data)
77
+    private function cacheServiceProvider($cacheItem, $cacheProvider, $data)
78 78
     {
79
-        if($cacheProvider($data)){
79
+        if ($cacheProvider($data)) {
80 80
             $cacheItem->set($data);
81 81
             $this->cache->save($cacheItem);
82 82
             $this->cacheServiceProvider = true;
@@ -93,23 +93,23 @@  discard block
 block discarded – undo
93 93
      * @param $data
94 94
      * @return bool|mixed
95 95
      */
96
-    private function containerCacheServiceProvider(callable $callback,$cacheItem,$data)
96
+    private function containerCacheServiceProvider(callable $callback, $cacheItem, $data)
97 97
     {
98
-        if($this->app->has('cache.class')){
98
+        if ($this->app->has('cache.class')) {
99 99
 
100 100
             $class = $this->app->get('cache.class');
101 101
 
102
-            if(is_callable(
102
+            if (is_callable(
103 103
                 $cacheProvider = $this->app->get('cache.'.class_basename($class[0]).':'.$class[1]))
104
-            ){
104
+            ) {
105 105
 
106
-                return $this->cacheServiceProvider($cacheItem,$cacheProvider,$data);
106
+                return $this->cacheServiceProvider($cacheItem, $cacheProvider, $data);
107 107
             }
108
-            elseif(is_callable(
108
+            elseif (is_callable(
109 109
                 $cacheProvider = $this->app->get('cache.'.class_basename($class[0])))
110 110
             )
111 111
             {
112
-                return $this->cacheServiceProvider($cacheItem,$cacheProvider,$data);
112
+                return $this->cacheServiceProvider($cacheItem, $cacheProvider, $data);
113 113
             }
114 114
         }
115 115
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     {
127 127
         //name variable is
128 128
         //the name of the cache data set to be created.
129
-        if(!is_null($name)){
129
+        if (!is_null($name)) {
130 130
             $this->name = $name;
131 131
         }
132 132
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     {
144 144
         //Cache data is set at the time.
145 145
         //Data will be valid in this time.
146
-        if(is_numeric($expire)){
146
+        if (is_numeric($expire)) {
147 147
             $this->expire = $expire;
148 148
         }
149 149
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     {
163 163
         // this class has a macro that can be managed by the user.
164 164
         // macros work as an extensible version of the classes.
165
-        $macro = $this->app['macro']->with(config('kernel.macros.cache'),$this,$this->adapter);
165
+        $macro = $this->app['macro']->with(config('kernel.macros.cache'), $this, $this->adapter);
166 166
 
167 167
         //set cache macroable object
168 168
         $this->cache = $macro->{$this->adapter}($callback);
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
         $backtrace = debug_backtrace()[1];
173 173
 
174 174
         //If name is null, we name it with backtrace.
175
-        if($this->name===null) {
175
+        if ($this->name===null) {
176 176
             $this->name = md5($backtrace['function'].'_'.$backtrace['class']);
177 177
         }
178 178
 
179 179
         //this method may show continuity depending on the macro.
180
-        if(false === $this instanceof $macro) return ;
180
+        if (false===$this instanceof $macro) return;
181 181
 
182 182
         // retrieve the cache item
183 183
         $cacheItem = $this->cache->getItem($this->name);
@@ -186,16 +186,16 @@  discard block
 block discarded – undo
186 186
 
187 187
             $data = call_user_func($callback);
188 188
 
189
-            return $this->containerCacheServiceProvider(function() use ($data,$cacheItem){
189
+            return $this->containerCacheServiceProvider(function() use ($data, $cacheItem){
190 190
                 $cacheItem->set($data);
191 191
                 $this->cache->save($cacheItem);
192 192
 
193 193
                 return $data;
194 194
 
195
-            },$cacheItem,$data);
195
+            },$cacheItem, $data);
196 196
         }
197 197
 
198
-        $this->app->register('illuminator','cache',['name'=>$this->name]);
198
+        $this->app->register('illuminator', 'cache', ['name'=>$this->name]);
199 199
 
200 200
         // retrieve the value stored by the item
201 201
         return $cacheItem->get();
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -104,8 +104,7 @@  discard block
 block discarded – undo
104 104
             ){
105 105
 
106 106
                 return $this->cacheServiceProvider($cacheItem,$cacheProvider,$data);
107
-            }
108
-            elseif(is_callable(
107
+            } elseif(is_callable(
109 108
                 $cacheProvider = $this->app->get('cache.'.class_basename($class[0])))
110 109
             )
111 110
             {
@@ -177,7 +176,9 @@  discard block
 block discarded – undo
177 176
         }
178 177
 
179 178
         //this method may show continuity depending on the macro.
180
-        if(false === $this instanceof $macro) return ;
179
+        if(false === $this instanceof $macro) {
180
+            return ;
181
+        }
181 182
 
182 183
         // retrieve the cache item
183 184
         $cacheItem = $this->cache->getItem($this->name);
Please login to merge, or discard this patch.
src/resta/Container/ContainerMethodDocumentResolver.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@
 block discarded – undo
45 45
     {
46 46
         $cacheData = [];
47 47
 
48
-        if(!isset($this->class[1]) && !is_object($this->class[0])) return;
48
+        if(!isset($this->class[1]) && !is_object($this->class[0])) {
49
+            return;
50
+        }
49 51
 
50 52
         // if you have information about cache in
51 53
         // the document section of the method, the cache process is executed.
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      * @param $reflection
25 25
      * @param array $class
26 26
      */
27
-    public function __construct($app,$reflection,$class=array())
27
+    public function __construct($app, $reflection, $class = array())
28 28
     {
29 29
         parent::__construct($app);
30 30
 
@@ -45,27 +45,27 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $cacheData = [];
47 47
 
48
-        if(!isset($this->class[1]) && !is_object($this->class[0])) return;
48
+        if (!isset($this->class[1]) && !is_object($this->class[0])) return;
49 49
 
50 50
         // if you have information about cache in
51 51
         // the document section of the method, the cache process is executed.
52
-        if($this->reflection->isAvailableMethodDocument($this->class[1],'cache')){
52
+        if ($this->reflection->isAvailableMethodDocument($this->class[1], 'cache')) {
53 53
 
54 54
             //as static we inject the name value into the cache data.
55 55
             $cacheData = ['cache'=>['name' => Utils::encryptArrayData($this->class)]];
56 56
 
57 57
             //cache data with the help of foreach data are transferred into the cache.
58
-            foreach(array_filter(explode(" ",$this->reflection->getDocumentData()),'strlen') as $item){
58
+            foreach (array_filter(explode(" ", $this->reflection->getDocumentData()), 'strlen') as $item) {
59 59
 
60
-                $items = explode("=",$item);
60
+                $items = explode("=", $item);
61 61
 
62 62
                 $cacheData['cache'][$items[0]] = $items[1];
63 63
 
64
-                if(in_array('query',$items)){
64
+                if (in_array('query', $items)) {
65 65
 
66
-                    foreach(explode(':',$items[1]) as $queryValue){
67
-                        $query = get($queryValue,null);
68
-                        if(!is_null($query)){
66
+                    foreach (explode(':', $items[1]) as $queryValue) {
67
+                        $query = get($queryValue, null);
68
+                        if (!is_null($query)) {
69 69
                             $cacheData['cache']['name'] = md5(sha1(
70 70
                                 $cacheData['cache']['name'].'_'.$queryValue.':'.$query
71 71
                             ));
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         }
78 78
 
79 79
         //we save the data stored in the cacheData variable as methodCache.
80
-        $this->app->register('cache','methodCache',$cacheData);
81
-        $this->app->register('cache','class',$this->class);
80
+        $this->app->register('cache', 'methodCache', $cacheData);
81
+        $this->app->register('cache', 'class', $this->class);
82 82
     }
83 83
 }
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Cache/CacheContainerResolver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     public function cacheProcess($callback)
19 19
     {
20 20
         //we do cache key control for method cache container data.
21
-        if(isset($this->app['cache']['methodCache']['cache'])){
21
+        if (isset($this->app['cache']['methodCache']['cache'])) {
22 22
 
23 23
             //get cache data
24 24
             $cache = $this->app['cache']['methodCache']['cache'];
Please login to merge, or discard this patch.