Passed
Push — main ( 693d0a...f1a9bd )
by BRUNO
12:17 queued 14s
created
src/DatalayerTrait.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
     }
156 156
 
157 157
     /**
158
-        * @param string $tableName
159
-        * @param string $tableAlias
160
-        * @return CrudBuilder|Crud|DatalayerTrait
158
+     * @param string $tableName
159
+     * @param string $tableAlias
160
+     * @return CrudBuilder|Crud|DatalayerTrait
161 161
      */
162 162
     protected function setTableName(string $tableName, string $tableAlias = ""): self
163 163
     {
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
     protected function getData(): array
233 233
     {
234
-       return $this->data;
234
+        return $this->data;
235 235
     }
236 236
 
237 237
     protected function setData(array $array): self
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
     }
251 251
 
252 252
     /**
253
-        * @param string $query
254
-        * @param array|null $params
255
-        * @return PDOStatement|void
253
+     * @param string $query
254
+     * @param array|null $params
255
+     * @return PDOStatement|void
256 256
      */
257 257
     protected function executeSQL(string $query, ?array $params = null)
258 258
     {
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
     }
281 281
 
282 282
     /**
283
-    * @param PDOStatement|null $prepare
284
-    * @return array|null
283
+     * @param PDOStatement|null $prepare
284
+     * @return array|null
285 285
      */
286 286
     protected function fetchArrayAssoc(?PDOStatement $prepare = null): ?array
287 287
     {
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
     }
345 345
 
346 346
     /**
347
-    * @param PDOStatement|null $prepare
348
-    * @return stdClass|null
347
+     * @param PDOStatement|null $prepare
348
+     * @return stdClass|null
349 349
      */
350 350
     protected function fetchOneObj(?PDOStatement $prepare = null): ?stdClass
351 351
     {
Please login to merge, or discard this patch.
src/CrudBuilder.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 abstract class CrudBuilder extends Crud
16 16
 {
17 17
     /**
18
-    * @var array
18
+     * @var array
19 19
      */
20 20
     private array $sqlPartsSelect = [
21 21
         'main'      => [],
@@ -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
     protected function selectBuilder(string $fields = "*", array $paramns = []): self
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
     protected function insertBuilder(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
     protected function updateBuilder(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
     protected function deleteBuilder(): 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
     protected 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
     protected 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
     protected 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
     protected function orWhere(string $condition, array $paramns = []): self
172 172
     {
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
     }
181 181
 
182 182
     /**
183
-    * @param string $parameter
184
-    * @param $order
185
-    * @return $this
183
+     * @param string $parameter
184
+     * @param $order
185
+     * @return $this
186 186
      */
187 187
     protected function orderBy(string $parameter, ?string $order = null): self
188 188
     {
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
     }
197 197
 
198 198
     /**
199
-    * @param string $parameter
200
-    * @param $order
201
-    * @return $this
199
+     * @param string $parameter
200
+     * @param $order
201
+     * @return $this
202 202
      */
203 203
     protected function addOrderBy(string $parameter, ?string $order = null): self
204 204
     {
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
     }
213 213
 
214 214
     /**
215
-    * @param string $texto
216
-    * @return $this
215
+     * @param string $texto
216
+     * @return $this
217 217
      */
218 218
     protected function limit(string $texto): self
219 219
     {
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
     }
224 224
 
225 225
     /**
226
-    * @param string $texto
227
-    * @return $this
226
+     * @param string $texto
227
+     * @return $this
228 228
      */
229 229
     protected function offset(string $texto): self
230 230
     {
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
     }
239 239
 
240 240
     /**
241
-    * @param string $texto
242
-    * @return $this
241
+     * @param string $texto
242
+     * @return $this
243 243
      */
244 244
     protected function groupBy(string $texto): self
245 245
     {
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
     }
254 254
 
255 255
     /**
256
-    * @param string $texto
257
-    * @return $this
256
+     * @param string $texto
257
+     * @return $this
258 258
      */
259 259
     protected function having(string $texto): self
260 260
     {
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
     }
299 299
 
300 300
     /**
301
-    * @param string $table
302
-    * @param string $alias
303
-    * @param string $codition
304
-    * @return $this
301
+     * @param string $table
302
+     * @param string $alias
303
+     * @param string $codition
304
+     * @return $this
305 305
      */
306 306
     protected function innerJoin(string $table, string $alias, string $codition): self
307 307
     {
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
     }
316 316
 
317 317
     /**
318
-    * @param string $table
319
-    * @param string $alias
320
-    * @param string $codition
321
-    * @return $this
318
+     * @param string $table
319
+     * @param string $alias
320
+     * @param string $codition
321
+     * @return $this
322 322
      */
323 323
     protected function leftJoin(string $table, string $alias, string $codition): self
324 324
     {
@@ -332,10 +332,10 @@  discard block
 block discarded – undo
332 332
     }
333 333
 
334 334
     /**
335
-    * @param string $table
336
-    * @param string $alias
337
-    * @param string $codition
338
-    * @return $this
335
+     * @param string $table
336
+     * @param string $alias
337
+     * @param string $codition
338
+     * @return $this
339 339
      */
340 340
     protected function rightJoin(string $table, string $alias, string $codition): self
341 341
     {
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
     }
374 374
 
375 375
     /**
376
-    * @return void
376
+     * @return void
377 377
      */
378 378
     protected function debug(): void
379 379
     {
@@ -387,10 +387,10 @@  discard block
 block discarded – undo
387 387
 
388 388
 
389 389
     /**
390
-    * @param string $query
391
-    * @param string $type
392
-    * @param array $params
393
-    * @return void
390
+     * @param string $query
391
+     * @param string $type
392
+     * @param array $params
393
+     * @return void
394 394
      */
395 395
     private function add(string $query, string $type, array $params = []): void
396 396
     {
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     protected function orderBy(string $parameter, ?string $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) {
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     protected function addOrderBy(string $parameter, ?string $order = null): self
204 204
     {
205 205
         try {
206
-            $query = ", {$parameter} ".($order ?? 'ASC')." ";
206
+            $query = ", {$parameter} " . ($order ?? 'ASC') . " ";
207 207
             $this->add($query, "addOrderBy");
208 208
             return $this;
209 209
         } catch (\PDOException $e) {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     protected function limit(string $texto): self
219 219
     {
220 220
         $query = "LIMIT {$texto}";
221
-        $this->add($query,"limit");
221
+        $this->add($query, "limit");
222 222
         return $this;
223 223
     }
224 224
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     {
231 231
         try {
232 232
             $query = "OFFSET {$texto}";
233
-            $this->add($query,"offset");
233
+            $this->add($query, "offset");
234 234
             return $this;
235 235
         } catch (\PDOException $e) {
236 236
             $this->setError($e);
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         try {
247 247
             $query = "GROUP BY {$texto}";
248
-            $this->add($query,"groupBy");
248
+            $this->add($query, "groupBy");
249 249
             return $this;
250 250
         } catch (\PDOException $e) {
251 251
             $this->setError($e);
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     {
261 261
         try {
262 262
             $query = "HAVING {$texto}";
263
-            $this->add($query,"having");
263
+            $this->add($query, "having");
264 264
             return $this;
265 265
         } catch (\PDOException $e) {
266 266
             $this->setError($e);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     {
276 276
         try {
277 277
             $query = "AND {$texto}";
278
-            $this->add($query,"andHaving");
278
+            $this->add($query, "andHaving");
279 279
             return $this;
280 280
         } catch (\PDOException $e) {
281 281
             $this->setError($e);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     {
291 291
         try {
292 292
             $query = "OR {$codition}";
293
-            $this->add($query,"orHaving");
293
+            $this->add($query, "orHaving");
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 = "INNER 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 = "LEFT 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);
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     {
342 342
         try {
343 343
             $query = "RIGHT JOIN {$table} AS {$alias} ON $codition";
344
-            $this->add($query,"join");
344
+            $this->add($query, "join");
345 345
             return $this;
346 346
         } catch (\PDOException $e) {
347 347
             $this->setError($e);
@@ -354,13 +354,13 @@  discard block
 block discarded – undo
354 354
     protected function executeQuery(): self
355 355
     {
356 356
         try {
357
-            foreach ($this->sqlPartsSelect as $key => $part){
357
+            foreach ($this->sqlPartsSelect as $key => $part) {
358 358
                 if (is_array($part)) {
359
-                    foreach ($part as $item){
360
-                        $this->setQuery($this->getQuery().$item);
359
+                    foreach ($part as $item) {
360
+                        $this->setQuery($this->getQuery() . $item);
361 361
                     }
362 362
                 } else {
363
-                    $this->setQuery($this->getQuery().$part);
363
+                    $this->setQuery($this->getQuery() . $part);
364 364
                 }
365 365
 
366 366
             }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
      */
395 395
     private function add(string $query, string $type, array $params = []): void
396 396
     {
397
-        $query = $query." ";
397
+        $query = $query . " ";
398 398
         try {
399 399
             if (is_array($this->sqlPartsSelect[$type])) {
400 400
                 $this->sqlPartsSelect[$type][] = $query;
Please login to merge, or discard this patch.
src/Crud.php 1 patch
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->getTableName()} ({$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);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             $sql .= " WHERE $where";
146 146
         }
147 147
         if ($debug) {
148
-            echo $sql.'<pre>'.print_r($values).'</pre>';
148
+            echo $sql . '<pre>' . print_r($values) . '</pre>';
149 149
             return;
150 150
         }
151 151
         $result = $this->executeSQL($sql, $values);
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             $sql .= " WHERE $where";
218 218
         }
219 219
         if ($debug) {
220
-            echo $sql.'<pre>'.print_r($values).'</pre>';
220
+            echo $sql . '<pre>' . print_r($values) . '</pre>';
221 221
             return;
222 222
         }
223 223
         $result = $this->executeSQL($sql, $values);
Please login to merge, or discard this patch.