Test Setup Failed
Push — master ( 68a798...ee2df9 )
by Php Easy Api
04:41
created
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.