Passed
Push — main ( 672c9e...b97579 )
by BRUNO
02:28
created
src/ModelAbstract.php 2 patches
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.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@
 block discarded – undo
49 49
     }
50 50
 
51 51
     /**
52
-    * @param $objArray
53
-    * @return array|null
52
+     * @param $objArray
53
+     * @return array|null
54 54
      */
55 55
     public function toMap($objArray = null): ?array
56 56
     {
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/DatalayerTrait.php 3 patches
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.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
     }
143 143
 
144 144
     /**
145
-        * @param string $tableName
146
-        * @param string $tableAlias
147
-        * @return CrudBuilder|Crud|DatalayerTrait
145
+     * @param string $tableName
146
+     * @param string $tableAlias
147
+     * @return CrudBuilder|Crud|DatalayerTrait
148 148
      */
149 149
     protected function setTable(string $tableName, string $tableAlias = ""): self
150 150
     {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
     protected function getResult(): array
201 201
     {
202
-       return $this->resultArray;
202
+        return $this->resultArray;
203 203
     }
204 204
 
205 205
     protected function setResult(array $array): self
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
     }
210 210
 
211 211
     /**
212
-        * @param string $query
213
-        * @param array|null $params
214
-        * @return PDOStatement|void
212
+     * @param string $query
213
+     * @param array|null $params
214
+     * @return PDOStatement|void
215 215
      */
216 216
     protected function executeSQL(string $query, ?array $params = null)
217 217
     {
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
     }
240 240
 
241 241
     /**
242
-    * @param PDOStatement|null $prepare
243
-    * @return array|null
242
+     * @param PDOStatement|null $prepare
243
+     * @return array|null
244 244
      */
245 245
     protected function fetchArrayAssoc(PDOStatement $prepare = null): ?array
246 246
     {
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
     }
304 304
 
305 305
     /**
306
-    * @param PDOStatement|null $prepare
307
-    * @return stdClass|null
306
+     * @param PDOStatement|null $prepare
307
+     * @return stdClass|null
308 308
      */
309 309
     protected function fetchOneObj(PDOStatement $prepare = null): ?stdClass
310 310
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         try {
74 74
             if (strpos($_SERVER['SERVER_NAME'], mb_strtolower(CONFIG_DATA_LAYER["homologation"])) && !strpos($this->getDatabase(), ucfirst(CONFIG_DATA_LAYER["homologation"]))) {
75
-                $database = $this->getDatabase().ucfirst(CONFIG_DATA_LAYER["homologation"] ?? "");
75
+                $database = $this->getDatabase() . ucfirst(CONFIG_DATA_LAYER["homologation"] ?? "");
76 76
                 $this->setDatabase($database);
77 77
             }
78 78
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     protected function setDatabase(string $database): self
116 116
     {
117 117
         if (strpos($_SERVER['SERVER_NAME'], mb_strtolower(CONFIG_DATA_LAYER["homologation"])) && !strpos($this->getDatabase(), ucfirst(CONFIG_DATA_LAYER["homologation"]))) {
118
-            $database = $database.ucfirst(CONFIG_DATA_LAYER["homologation"] ?? "");
118
+            $database = $database . ucfirst(CONFIG_DATA_LAYER["homologation"] ?? "");
119 119
         }
120 120
 
121 121
         $this->database = $database;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             $prepare = empty($prepare) ? $this->getPrepare() : $prepare;
244 244
             return $prepare->rowCount();
245 245
         } catch (PDOException $e) {
246
-            $this->setError($e);}
246
+            $this->setError($e); }
247 247
     }
248 248
 
249 249
     /**
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) {
@@ -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.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     protected 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
     protected 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
     protected 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
     protected 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.
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     use DatalayerTrait;
18 18
 
19 19
     /**
20
-    * @var array
20
+     * @var array
21 21
      */
22 22
     private array $sqlPartsSelect = [
23 23
         'main'      => [],
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 
38 38
     /**
39 39
      *
40
-    * <code>
41
-    *   $qb = $this->select('u.id, p.id')
42
-    *           ->where('phonenumbers=?', [$number]);
43
-    * </code>
44
-    * @param string $fields
45
-    * @param array $paramns
46
-    * @return $this
40
+     * <code>
41
+     *   $qb = $this->select('u.id, p.id')
42
+     *           ->where('phonenumbers=?', [$number]);
43
+     * </code>
44
+     * @param string $fields
45
+     * @param array $paramns
46
+     * @return $this
47 47
      */
48 48
     protected function select(string $fields = "*", array $paramns = []): CrudBuilder
49 49
     {
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
     }
60 60
 
61 61
     /**
62
-    * @param string $fields
63
-    * @param array $paramns
64
-    * @return $this
62
+     * @param string $fields
63
+     * @param array $paramns
64
+     * @return $this
65 65
      */
66 66
     protected function insert(string $fields, array $paramns): self
67 67
     {
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
     }
81 81
 
82 82
     /**
83
-    * @param string $fields
84
-    * @param array $paramns
85
-    * @return $this
83
+     * @param string $fields
84
+     * @param array $paramns
85
+     * @return $this
86 86
      */
87 87
     protected function update(string $fields, array $paramns): self
88 88
     {
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
     }
104 104
 
105 105
     /**
106
-    * @param string $fields
107
-    * @param array $paramns
108
-    * @return $this
106
+     * @param string $fields
107
+     * @param array $paramns
108
+     * @return $this
109 109
      */
110 110
     protected function delete(): self
111 111
     {
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
     }
120 120
 
121 121
     /**
122
-    * @param string $query
123
-    * @param array $paramns
124
-    * @return $this
122
+     * @param string $query
123
+     * @param array $paramns
124
+     * @return $this
125 125
      */
126 126
     protected function query(string $query, array $paramns = []): self
127 127
     {
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
     }
135 135
 
136 136
     /**
137
-    * @param string $texto
138
-    * @param array $paramns
139
-    * @return $this
137
+     * @param string $texto
138
+     * @param array $paramns
139
+     * @return $this
140 140
      */
141 141
     protected function where(string $texto, array $paramns = []): self
142 142
     {
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
     }
151 151
 
152 152
     /**
153
-    * @param string $condition
154
-    * @param array $paramns
155
-    * @return $this
153
+     * @param string $condition
154
+     * @param array $paramns
155
+     * @return $this
156 156
      */
157 157
     protected function andWhere(string $condition, array $paramns = []): self
158 158
     {
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
     }
167 167
 
168 168
     /**
169
-    * @param string $condition
170
-    * @param array $paramns
171
-    * @return $this
169
+     * @param string $condition
170
+     * @param array $paramns
171
+     * @return $this
172 172
      */
173 173
     protected function orWhere(string $condition, array $paramns = []): self
174 174
     {
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
     }
183 183
 
184 184
     /**
185
-    * @param string $parameter
186
-    * @return $this
185
+     * @param string $parameter
186
+     * @return $this
187 187
      */
188 188
     protected function orderBy(string $parameter, $order = null): self
189 189
     {
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
     }
209 209
 
210 210
     /**
211
-    * @param string $texto
212
-    * @return $this
211
+     * @param string $texto
212
+     * @return $this
213 213
      */
214 214
     protected function limit(string $texto): self
215 215
     {
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
     }
220 220
 
221 221
     /**
222
-    * @param string $texto
223
-    * @return $this
222
+     * @param string $texto
223
+     * @return $this
224 224
      */
225 225
     protected function offset(string $texto): self
226 226
     {
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
     }
235 235
 
236 236
     /**
237
-    * @param string $texto
238
-    * @return $this
237
+     * @param string $texto
238
+     * @return $this
239 239
      */
240 240
     protected function groupBy(string $texto): self
241 241
     {
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
     }
250 250
 
251 251
     /**
252
-    * @param string $texto
253
-    * @return $this
252
+     * @param string $texto
253
+     * @return $this
254 254
      */
255 255
     protected function having(string $texto): self
256 256
     {
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
     }
295 295
 
296 296
     /**
297
-    * @param string $table
298
-    * @param string $alias
299
-    * @param string $codition
300
-    * @return $this
297
+     * @param string $table
298
+     * @param string $alias
299
+     * @param string $codition
300
+     * @return $this
301 301
      */
302 302
     protected function innerJoin(string $table, string $alias, string $codition): self
303 303
     {
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
     }
312 312
 
313 313
     /**
314
-    * @param string $table
315
-    * @param string $alias
316
-    * @param string $codition
317
-    * @return $this
314
+     * @param string $table
315
+     * @param string $alias
316
+     * @param string $codition
317
+     * @return $this
318 318
      */
319 319
     protected function leftJoin(string $table, string $alias, string $codition): self
320 320
     {
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
     }
329 329
 
330 330
     /**
331
-    * @param string $table
332
-    * @param string $alias
333
-    * @param string $codition
334
-    * @return $this
331
+     * @param string $table
332
+     * @param string $alias
333
+     * @param string $codition
334
+     * @return $this
335 335
      */
336 336
     protected function rightJoin(string $table, string $alias, string $codition): self
337 337
     {
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     }
370 370
 
371 371
     /**
372
-    * @return void
372
+     * @return void
373 373
      */
374 374
     protected function debug()
375 375
     {
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
     }
407 407
 
408 408
     /**
409
-    * @param $params
410
-    * @return self
409
+     * @param $params
410
+     * @return self
411 411
      */
412 412
     protected function setParameter($params): self
413 413
     {
@@ -416,10 +416,10 @@  discard block
 block discarded – undo
416 416
     }
417 417
 
418 418
     /**
419
-    * @param string $query
420
-    * @param string $type
421
-    * @param array $params
422
-    * @return void
419
+     * @param string $query
420
+     * @param string $type
421
+     * @param array $params
422
+     * @return void
423 423
      */
424 424
     private function add(string $query, string $type, array $params = []): void
425 425
     {
Please login to merge, or discard this patch.