Passed
Push — main ( 348036...757c8d )
by BRUNO
02:02
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
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.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 
37 37
     /**
38 38
      *
39
-    * <code>
40
-    *   $qb = $this->select('u.id, p.id')
41
-    *           ->where('phonenumbers=?', [$number]);
42
-    * </code>
43
-    * @param string $fields
44
-    * @param array $paramns
45
-    * @return $this
39
+     * <code>
40
+     *   $qb = $this->select('u.id, p.id')
41
+     *           ->where('phonenumbers=?', [$number]);
42
+     * </code>
43
+     * @param string $fields
44
+     * @param array $paramns
45
+     * @return $this
46 46
      */
47 47
     private function select(string $fields = "*", array $paramns = []): CrudBuilder
48 48
     {
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
     }
59 59
 
60 60
     /**
61
-    * @param string $fields
62
-    * @param array $paramns
63
-    * @return $this
61
+     * @param string $fields
62
+     * @param array $paramns
63
+     * @return $this
64 64
      */
65 65
     private function insert(string $fields, array $paramns): self
66 66
     {
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
     }
80 80
 
81 81
     /**
82
-    * @param string $fields
83
-    * @param array $paramns
84
-    * @return $this
82
+     * @param string $fields
83
+     * @param array $paramns
84
+     * @return $this
85 85
      */
86 86
     private function update(string $fields, array $paramns): self
87 87
     {
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
     }
103 103
 
104 104
     /**
105
-    * @param string $fields
106
-    * @param array $paramns
107
-    * @return $this
105
+     * @param string $fields
106
+     * @param array $paramns
107
+     * @return $this
108 108
      */
109 109
     private function delete(): self
110 110
     {
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
     }
119 119
 
120 120
     /**
121
-    * @param string $query
122
-    * @param array $paramns
123
-    * @return $this
121
+     * @param string $query
122
+     * @param array $paramns
123
+     * @return $this
124 124
      */
125 125
     private function query(string $query, array $paramns = []): self
126 126
     {
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
     }
134 134
 
135 135
     /**
136
-    * @param string $texto
137
-    * @param array $paramns
138
-    * @return $this
136
+     * @param string $texto
137
+     * @param array $paramns
138
+     * @return $this
139 139
      */
140 140
     private function where(string $texto, array $paramns = []): self
141 141
     {
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
     }
150 150
 
151 151
     /**
152
-    * @param string $condition
153
-    * @param array $paramns
154
-    * @return $this
152
+     * @param string $condition
153
+     * @param array $paramns
154
+     * @return $this
155 155
      */
156 156
     private function andWhere(string $condition, array $paramns = []): self
157 157
     {
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
     }
166 166
 
167 167
     /**
168
-    * @param string $condition
169
-    * @param array $paramns
170
-    * @return $this
168
+     * @param string $condition
169
+     * @param array $paramns
170
+     * @return $this
171 171
      */
172 172
     private function orWhere(string $condition, array $paramns = []): self
173 173
     {
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
     }
182 182
 
183 183
     /**
184
-    * @param string $parameter
185
-    * @return $this
184
+     * @param string $parameter
185
+     * @return $this
186 186
      */
187 187
     private function orderBy(string $parameter, $order = null): self
188 188
     {
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
     }
208 208
 
209 209
     /**
210
-    * @param string $texto
211
-    * @return $this
210
+     * @param string $texto
211
+     * @return $this
212 212
      */
213 213
     private function limit(string $texto): self
214 214
     {
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
     }
219 219
 
220 220
     /**
221
-    * @param string $texto
222
-    * @return $this
221
+     * @param string $texto
222
+     * @return $this
223 223
      */
224 224
     private function offset(string $texto): self
225 225
     {
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
     }
234 234
 
235 235
     /**
236
-    * @param string $texto
237
-    * @return $this
236
+     * @param string $texto
237
+     * @return $this
238 238
      */
239 239
     private function groupBy(string $texto): self
240 240
     {
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
     }
249 249
 
250 250
     /**
251
-    * @param string $texto
252
-    * @return $this
251
+     * @param string $texto
252
+     * @return $this
253 253
      */
254 254
     private function having(string $texto): self
255 255
     {
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
     }
294 294
 
295 295
     /**
296
-    * @param string $table
297
-    * @param string $alias
298
-    * @param string $codition
299
-    * @return $this
296
+     * @param string $table
297
+     * @param string $alias
298
+     * @param string $codition
299
+     * @return $this
300 300
      */
301 301
     private function innerJoin(string $table, string $alias, string $codition): self
302 302
     {
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
     }
311 311
 
312 312
     /**
313
-    * @param string $table
314
-    * @param string $alias
315
-    * @param string $codition
316
-    * @return $this
313
+     * @param string $table
314
+     * @param string $alias
315
+     * @param string $codition
316
+     * @return $this
317 317
      */
318 318
     private function leftJoin(string $table, string $alias, string $codition): self
319 319
     {
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
     }
328 328
 
329 329
     /**
330
-    * @param string $table
331
-    * @param string $alias
332
-    * @param string $codition
333
-    * @return $this
330
+     * @param string $table
331
+     * @param string $alias
332
+     * @param string $codition
333
+     * @return $this
334 334
      */
335 335
     private function rightJoin(string $table, string $alias, string $codition): self
336 336
     {
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
     }
369 369
 
370 370
     /**
371
-    * @return void
371
+     * @return void
372 372
      */
373 373
     private function debug()
374 374
     {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     private function orderBy(string $parameter, $order = null): self
188 188
     {
189 189
         try {
190
-            $query = "ORDER BY {$parameter} ".($order ?? 'ASC');
190
+            $query = "ORDER BY {$parameter} " . ($order ?? 'ASC');
191 191
             $this->add($query, "orderBy");
192 192
             return $this;
193 193
         } catch (\PDOException $e) {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     private function addOrderBy(string $parameter, $order = null): self
199 199
     {
200 200
         try {
201
-            $query = ", {$parameter} ".($order ?? 'ASC')." ";
201
+            $query = ", {$parameter} " . ($order ?? 'ASC') . " ";
202 202
             $this->add($query, "addOrderBy");
203 203
             return $this;
204 204
         } catch (\PDOException $e) {
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     private function limit(string $texto): self
214 214
     {
215 215
         $query = "LIMIT {$texto}";
216
-        $this->add($query,"limit");
216
+        $this->add($query, "limit");
217 217
         return $this;
218 218
     }
219 219
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     {
226 226
         try {
227 227
             $query = "OFFSET {$texto}";
228
-            $this->add($query,"offset");
228
+            $this->add($query, "offset");
229 229
             return $this;
230 230
         } catch (\PDOException $e) {
231 231
             $this->setError($e);
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     {
241 241
         try {
242 242
             $query = "GROUP BY {$texto}";
243
-            $this->add($query,"groupBy");
243
+            $this->add($query, "groupBy");
244 244
             return $this;
245 245
         } catch (\PDOException $e) {
246 246
             $this->setError($e);
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     {
256 256
         try {
257 257
             $query = "HAVING {$texto}";
258
-            $this->add($query,"having");
258
+            $this->add($query, "having");
259 259
             return $this;
260 260
         } catch (\PDOException $e) {
261 261
             $this->setError($e);
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     {
271 271
         try {
272 272
             $query = "AND {$texto}";
273
-            $this->add($query,"andHaving");
273
+            $this->add($query, "andHaving");
274 274
             return $this;
275 275
         } catch (\PDOException $e) {
276 276
             $this->setError($e);
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
     {
286 286
         try {
287 287
             $query = "OR {$codition}";
288
-            $this->add($query,"orHaving");
288
+            $this->add($query, "orHaving");
289 289
             return $this;
290 290
         } catch (\PDOException $e) {
291 291
             $this->setError($e);
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     {
303 303
         try {
304 304
             $query = "INNER JOIN {$table} AS {$alias} ON $codition";
305
-            $this->add($query,"join");
305
+            $this->add($query, "join");
306 306
             return $this;
307 307
         } catch (\PDOException $e) {
308 308
             $this->setError($e);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
     {
320 320
         try {
321 321
             $query = "LEFT JOIN {$table} AS {$alias} ON {$codition}";
322
-            $this->add($query,"join");
322
+            $this->add($query, "join");
323 323
             return $this;
324 324
         } catch (\PDOException $e) {
325 325
             $this->setError($e);
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
     {
337 337
         try {
338 338
             $query = "RIGHT JOIN {$table} AS {$alias} ON $codition";
339
-            $this->add($query,"join");
339
+            $this->add($query, "join");
340 340
             return $this;
341 341
         } catch (\PDOException $e) {
342 342
             $this->setError($e);
@@ -349,9 +349,9 @@  discard block
 block discarded – undo
349 349
     private function executeQuery(): self
350 350
     {
351 351
         try {
352
-            foreach ($this->sqlPartsSelect as $key => $part){
352
+            foreach ($this->sqlPartsSelect as $key => $part) {
353 353
                 if (is_array($part)) {
354
-                    foreach ($part as $item){
354
+                    foreach ($part as $item) {
355 355
                         $this->query .= $item;
356 356
                     }
357 357
                 } else {
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 
413 413
     private function add(string $text, string $type, array $params = [])
414 414
     {
415
-        $text = $text." ";
415
+        $text = $text . " ";
416 416
         try {
417 417
             if (is_array($this->sqlPartsSelect[$type])) {
418 418
                 $this->sqlPartsSelect[$type][] = $text;
Please login to merge, or discard this patch.