Passed
Push — main ( 5eac8c...ece782 )
by BRUNO
02:03
created
src/CrudBuilder.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     public function orderBy(string $texto, $order = null): self
187 187
     {
188 188
         try {
189
-            $query = "ORDER BY {$texto} ".($order ?? 'ASC')." ";
189
+            $query = "ORDER BY {$texto} " . ($order ?? 'ASC') . " ";
190 190
             $this->add($query, "orderBy");
191 191
             return $this;
192 192
         } catch (\PDOException $e) {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     public function limit(string $texto): self
202 202
     {
203 203
         $query = "LIMIT {$texto}";
204
-        $this->add($query,"limit");
204
+        $this->add($query, "limit");
205 205
         return $this;
206 206
     }
207 207
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     {
214 214
         try {
215 215
             $query = "OFFSET {$texto}";
216
-            $this->add($query,"offset");
216
+            $this->add($query, "offset");
217 217
             return $this;
218 218
         } catch (\PDOException $e) {
219 219
             $this->setError($e);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     {
229 229
         try {
230 230
             $query = "GROUP BY {$texto}";
231
-            $this->add($query,"groupBy");
231
+            $this->add($query, "groupBy");
232 232
             return $this;
233 233
         } catch (\PDOException $e) {
234 234
             $this->setError($e);
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     {
244 244
         try {
245 245
             $query = "HAVING {$texto}";
246
-            $this->add($query,"having");
246
+            $this->add($query, "having");
247 247
             return $this;
248 248
         } catch (\PDOException $e) {
249 249
             $this->setError($e);
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     {
259 259
         try {
260 260
             $query = "AND {$texto}";
261
-            $this->add($query,"andHaving");
261
+            $this->add($query, "andHaving");
262 262
             return $this;
263 263
         } catch (\PDOException $e) {
264 264
             $this->setError($e);
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     {
274 274
         try {
275 275
             $query = "OR {$codition}";
276
-            $this->add($query,"orHaving");
276
+            $this->add($query, "orHaving");
277 277
             return $this;
278 278
         } catch (\PDOException $e) {
279 279
             $this->setError($e);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     {
291 291
         try {
292 292
             $query = "INNER JOIN {$table} AS {$alias} ON $codition";
293
-            $this->add($query,"join");
293
+            $this->add($query, "join");
294 294
             return $this;
295 295
         } catch (\PDOException $e) {
296 296
             $this->setError($e);
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     {
308 308
         try {
309 309
             $query = "LEFT JOIN {$table} AS {$alias} ON {$codition}";
310
-            $this->add($query,"join");
310
+            $this->add($query, "join");
311 311
             return $this;
312 312
         } catch (\PDOException $e) {
313 313
             $this->setError($e);
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     {
325 325
         try {
326 326
             $query = "RIGHT JOIN {$table} AS {$alias} ON $codition";
327
-            $this->add($query,"join");
327
+            $this->add($query, "join");
328 328
             return $this;
329 329
         } catch (\PDOException $e) {
330 330
             $this->setError($e);
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
     public function executeQuery(): self
338 338
     {
339 339
         try {
340
-            foreach ($this->sqlPartsSelect as $key => $part){
340
+            foreach ($this->sqlPartsSelect as $key => $part) {
341 341
                 if (is_array($part)) {
342
-                    foreach ($part as $item){
342
+                    foreach ($part as $item) {
343 343
                         $this->query .= $item;
344 344
                     }
345 345
                 } else {
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 
401 401
     private function add(string $text, string $type, array $params = [])
402 402
     {
403
-        $text = $text." ";
403
+        $text = $text . " ";
404 404
         try {
405 405
             if (is_array($this->sqlPartsSelect[$type])) {
406 406
                 $this->sqlPartsSelect[$type][] = $text;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@  discard block
 block discarded – undo
47 47
     {
48 48
         try {
49 49
             $query = "SELECT {$fields} FROM {$this->getTable()}";
50
-            if (!empty($this->getTableAlias()))
51
-                $query .= "AS {$this->getTableAlias()} ";
50
+            if (!empty($this->getTableAlias())) {
51
+                            $query .= "AS {$this->getTableAlias()} ";
52
+            }
52 53
             $this->add($query, "main", $paramns);
53 54
             return $this;
54 55
         } catch (\PDOException $e) {
@@ -408,8 +409,9 @@  discard block
 block discarded – undo
408 409
                 $this->sqlPartsSelect[$type] = $text;
409 410
             }
410 411
 
411
-            if (!empty($params))
412
-                $this->params = array_merge($this->params, $params);
412
+            if (!empty($params)) {
413
+                            $this->params = array_merge($this->params, $params);
414
+            }
413 415
         } catch (\PDOException $e) {
414 416
             $this->setError($e);
415 417
         }
Please login to merge, or discard this patch.