Passed
Push — main ( 46dc6a...1f4681 )
by BRUNO
01:56
created
src/ModelAbstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
         }
88 88
 
89 89
         return $classname . ' {' . implode(', ', array_map(
90
-            function ($p_0) use ($data) {
90
+            function($p_0) use ($data) {
91 91
                 $p_0->setAccessible(true);
92 92
 
93 93
                 return $p_0->getName() . ': ' . $p_0->getValue($data);
Please login to merge, or discard this patch.
src/DatalayerTrait.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@
 block discarded – undo
164 164
             $prepare = empty($prepare) ? $this->prepare : $prepare;
165 165
             return $prepare->rowCount();
166 166
         } catch (PDOException $e) {
167
-            $this->setError($e);}
167
+            $this->setError($e); }
168 168
     }
169 169
 
170 170
     /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,8 +132,9 @@
 block discarded – undo
132 132
      */
133 133
     protected function setTable(string $tableName, string $tableAlias = ""): self
134 134
     {
135
-        if (!empty($tableAlias))
136
-            $this->tableAlias = $tableAlias;
135
+        if (!empty($tableAlias)) {
136
+                    $this->tableAlias = $tableAlias;
137
+        }
137 138
         $this->tableName = $tableName;
138 139
         return $this;
139 140
     }
Please login to merge, or discard this patch.
src/Crud.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function select(string $fields = '*', string $add = '', array $values = null, bool $returnModel = false, bool $debug = false)
29 29
     {
30
-        if (strlen($add) > 0) {
30
+        if (strlen($add)>0) {
31 31
             $add = ' ' . $add;
32 32
         }
33 33
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $numparams = substr($numparams, 1);
67 67
         $sql = "INSERT INTO {$this->getTable()} ({$fields}) VALUES ({$numparams})";
68 68
         if ($debug) {
69
-            echo $sql.'<pre>'.print_r($values).'</pre>';
69
+            echo $sql . '<pre>' . print_r($values) . '</pre>';
70 70
             return;
71 71
         }
72 72
         $result = $this->executeSQL($sql, $values);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             $sql .= " WHERE $where";
149 149
         }
150 150
         if ($debug) {
151
-            echo $sql.'<pre>'.print_r($values).'</pre>';
151
+            echo $sql . '<pre>' . print_r($values) . '</pre>';
152 152
             return;
153 153
         }
154 154
         $result = $this->executeSQL($sql, $values);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             $sql .= " WHERE $where";
224 224
         }
225 225
         if ($debug) {
226
-            echo $sql.'<pre>'.print_r($values).'</pre>';
226
+            echo $sql . '<pre>' . print_r($values) . '</pre>';
227 227
             return;
228 228
         }
229 229
         $result = $this->executeSQL($sql, $values);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@
 block discarded – undo
33 33
 
34 34
         $sql = "SELECT {$fields} FROM {$this->getTable()}";
35 35
 
36
-        if (!empty($this->getTableAlias()))
37
-            $sql .= " AS {$this->getTableAlias()}";
36
+        if (!empty($this->getTableAlias())) {
37
+                    $sql .= " AS {$this->getTableAlias()}";
38
+        }
38 39
 
39 40
         $sql .= "{$add}";
40 41
 
Please login to merge, or discard this patch.
src/CrudBuilder.php 3 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 
36 36
     /**
37 37
      *
38
-    * <code>
39
-    *   $qb = $this->select('u.id, p.id')
40
-    *           ->where('phonenumbers=?', [$number]);
41
-    * </code>
42
-    * @param string $fields
43
-    * @param array $paramns
44
-    * @return $this
38
+     * <code>
39
+     *   $qb = $this->select('u.id, p.id')
40
+     *           ->where('phonenumbers=?', [$number]);
41
+     * </code>
42
+     * @param string $fields
43
+     * @param array $paramns
44
+     * @return $this
45 45
      */
46 46
     private function select(string $fields = "*", array $paramns = []): CrudBuilder
47 47
     {
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
     }
58 58
 
59 59
     /**
60
-    * @param string $fields
61
-    * @param array $paramns
62
-    * @return $this
60
+     * @param string $fields
61
+     * @param array $paramns
62
+     * @return $this
63 63
      */
64 64
     private function insert(string $fields, array $paramns): self
65 65
     {
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
     }
79 79
 
80 80
     /**
81
-    * @param string $fields
82
-    * @param array $paramns
83
-    * @return $this
81
+     * @param string $fields
82
+     * @param array $paramns
83
+     * @return $this
84 84
      */
85 85
     private function update(string $fields, array $paramns): self
86 86
     {
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
     }
102 102
 
103 103
     /**
104
-    * @param string $fields
105
-    * @param array $paramns
106
-    * @return $this
104
+     * @param string $fields
105
+     * @param array $paramns
106
+     * @return $this
107 107
      */
108 108
     private function delete(): self
109 109
     {
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
     }
118 118
 
119 119
     /**
120
-    * @param string $query
121
-    * @param array $paramns
122
-    * @return $this
120
+     * @param string $query
121
+     * @param array $paramns
122
+     * @return $this
123 123
      */
124 124
     private function query(string $query, array $paramns = []): self
125 125
     {
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
     }
133 133
 
134 134
     /**
135
-    * @param string $texto
136
-    * @param array $paramns
137
-    * @return $this
135
+     * @param string $texto
136
+     * @param array $paramns
137
+     * @return $this
138 138
      */
139 139
     private function where(string $texto, array $paramns = []): self
140 140
     {
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
     }
149 149
 
150 150
     /**
151
-    * @param string $condition
152
-    * @param array $paramns
153
-    * @return $this
151
+     * @param string $condition
152
+     * @param array $paramns
153
+     * @return $this
154 154
      */
155 155
     private function andWhere(string $condition, array $paramns = []): self
156 156
     {
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
     }
165 165
 
166 166
     /**
167
-    * @param string $condition
168
-    * @param array $paramns
169
-    * @return $this
167
+     * @param string $condition
168
+     * @param array $paramns
169
+     * @return $this
170 170
      */
171 171
     private function orWhere(string $condition, array $paramns = []): self
172 172
     {
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
     }
181 181
 
182 182
     /**
183
-    * @param string $parameter
184
-    * @return $this
183
+     * @param string $parameter
184
+     * @return $this
185 185
      */
186 186
     private function orderBy(string $parameter, $order = null): self
187 187
     {
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
     }
207 207
 
208 208
     /**
209
-    * @param string $texto
210
-    * @return $this
209
+     * @param string $texto
210
+     * @return $this
211 211
      */
212 212
     private function limit(string $texto): self
213 213
     {
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
     }
218 218
 
219 219
     /**
220
-    * @param string $texto
221
-    * @return $this
220
+     * @param string $texto
221
+     * @return $this
222 222
      */
223 223
     private function offset(string $texto): self
224 224
     {
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
     }
233 233
 
234 234
     /**
235
-    * @param string $texto
236
-    * @return $this
235
+     * @param string $texto
236
+     * @return $this
237 237
      */
238 238
     private function groupBy(string $texto): self
239 239
     {
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
     }
248 248
 
249 249
     /**
250
-    * @param string $texto
251
-    * @return $this
250
+     * @param string $texto
251
+     * @return $this
252 252
      */
253 253
     private function having(string $texto): self
254 254
     {
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
     }
293 293
 
294 294
     /**
295
-    * @param string $table
296
-    * @param string $alias
297
-    * @param string $codition
298
-    * @return $this
295
+     * @param string $table
296
+     * @param string $alias
297
+     * @param string $codition
298
+     * @return $this
299 299
      */
300 300
     private function innerJoin(string $table, string $alias, string $codition): self
301 301
     {
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
     }
310 310
 
311 311
     /**
312
-    * @param string $table
313
-    * @param string $alias
314
-    * @param string $codition
315
-    * @return $this
312
+     * @param string $table
313
+     * @param string $alias
314
+     * @param string $codition
315
+     * @return $this
316 316
      */
317 317
     private function leftJoin(string $table, string $alias, string $codition): self
318 318
     {
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
     }
327 327
 
328 328
     /**
329
-    * @param string $table
330
-    * @param string $alias
331
-    * @param string $codition
332
-    * @return $this
329
+     * @param string $table
330
+     * @param string $alias
331
+     * @param string $codition
332
+     * @return $this
333 333
      */
334 334
     private function rightJoin(string $table, string $alias, string $codition): self
335 335
     {
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
     }
368 368
 
369 369
     /**
370
-    * @return void
370
+     * @return void
371 371
      */
372 372
     private function debug()
373 373
     {
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
     }
405 405
 
406 406
     /**
407
-    * @param $params
408
-    * @return self
407
+     * @param $params
408
+     * @return self
409 409
      */
410 410
     private function setParameter($params): self
411 411
     {
@@ -414,10 +414,10 @@  discard block
 block discarded – undo
414 414
     }
415 415
 
416 416
     /**
417
-    * @param string $query
418
-    * @param string $type
419
-    * @param array $params
420
-    * @return void
417
+     * @param string $query
418
+     * @param string $type
419
+     * @param array $params
420
+     * @return void
421 421
      */
422 422
     private function add(string $query, string $type, array $params = []): void
423 423
     {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     private function orderBy(string $parameter, $order = null): self
187 187
     {
188 188
         try {
189
-            $query = "ORDER BY {$parameter} ".($order ?? 'ASC');
189
+            $query = "ORDER BY {$parameter} " . ($order ?? 'ASC');
190 190
             $this->add($query, "orderBy");
191 191
             return $this;
192 192
         } catch (\PDOException $e) {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     private function addOrderBy(string $parameter, $order = null): self
198 198
     {
199 199
         try {
200
-            $query = ", {$parameter} ".($order ?? 'ASC')." ";
200
+            $query = ", {$parameter} " . ($order ?? 'ASC') . " ";
201 201
             $this->add($query, "addOrderBy");
202 202
             return $this;
203 203
         } catch (\PDOException $e) {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     private function limit(string $texto): self
213 213
     {
214 214
         $query = "LIMIT {$texto}";
215
-        $this->add($query,"limit");
215
+        $this->add($query, "limit");
216 216
         return $this;
217 217
     }
218 218
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     {
225 225
         try {
226 226
             $query = "OFFSET {$texto}";
227
-            $this->add($query,"offset");
227
+            $this->add($query, "offset");
228 228
             return $this;
229 229
         } catch (\PDOException $e) {
230 230
             $this->setError($e);
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     {
240 240
         try {
241 241
             $query = "GROUP BY {$texto}";
242
-            $this->add($query,"groupBy");
242
+            $this->add($query, "groupBy");
243 243
             return $this;
244 244
         } catch (\PDOException $e) {
245 245
             $this->setError($e);
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     {
255 255
         try {
256 256
             $query = "HAVING {$texto}";
257
-            $this->add($query,"having");
257
+            $this->add($query, "having");
258 258
             return $this;
259 259
         } catch (\PDOException $e) {
260 260
             $this->setError($e);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
     {
270 270
         try {
271 271
             $query = "AND {$texto}";
272
-            $this->add($query,"andHaving");
272
+            $this->add($query, "andHaving");
273 273
             return $this;
274 274
         } catch (\PDOException $e) {
275 275
             $this->setError($e);
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
     {
285 285
         try {
286 286
             $query = "OR {$codition}";
287
-            $this->add($query,"orHaving");
287
+            $this->add($query, "orHaving");
288 288
             return $this;
289 289
         } catch (\PDOException $e) {
290 290
             $this->setError($e);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     {
302 302
         try {
303 303
             $query = "INNER JOIN {$table} AS {$alias} ON $codition";
304
-            $this->add($query,"join");
304
+            $this->add($query, "join");
305 305
             return $this;
306 306
         } catch (\PDOException $e) {
307 307
             $this->setError($e);
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     {
319 319
         try {
320 320
             $query = "LEFT JOIN {$table} AS {$alias} ON {$codition}";
321
-            $this->add($query,"join");
321
+            $this->add($query, "join");
322 322
             return $this;
323 323
         } catch (\PDOException $e) {
324 324
             $this->setError($e);
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     {
336 336
         try {
337 337
             $query = "RIGHT JOIN {$table} AS {$alias} ON $codition";
338
-            $this->add($query,"join");
338
+            $this->add($query, "join");
339 339
             return $this;
340 340
         } catch (\PDOException $e) {
341 341
             $this->setError($e);
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
     private function executeQuery(): self
349 349
     {
350 350
         try {
351
-            foreach ($this->sqlPartsSelect as $key => $part){
351
+            foreach ($this->sqlPartsSelect as $key => $part) {
352 352
                 if (is_array($part)) {
353
-                    foreach ($part as $item){
353
+                    foreach ($part as $item) {
354 354
                         $this->query .= $item;
355 355
                     }
356 356
                 } else {
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
      */
422 422
     private function add(string $query, string $type, array $params = []): void
423 423
     {
424
-        $query = $query." ";
424
+        $query = $query . " ";
425 425
         try {
426 426
             if (is_array($this->sqlPartsSelect[$type])) {
427 427
                 $this->sqlPartsSelect[$type][] = $query;
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) {
@@ -429,8 +430,9 @@  discard block
 block discarded – undo
429 430
                 $this->sqlPartsSelect[$type] = $query;
430 431
             }
431 432
 
432
-            if (!empty($params))
433
-                $this->params = array_merge($this->params, $params);
433
+            if (!empty($params)) {
434
+                            $this->params = array_merge($this->params, $params);
435
+            }
434 436
         } catch (\PDOException $e) {
435 437
             $this->setError($e);
436 438
         }
Please login to merge, or discard this patch.