Passed
Push — main ( 488351...ff7bb8 )
by BRUNO
10:46 queued 08:05
created
src/DatalayerTrait.php 1 patch
Spacing   +4 added lines, -4 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,13 +115,13 @@  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($database, ucfirst(CONFIG_DATA_LAYER["homologation"]))) {
118
-            $database = $database.ucfirst(CONFIG_DATA_LAYER["homologation"] ?? "");
118
+            $database = $database . ucfirst(CONFIG_DATA_LAYER["homologation"] ?? "");
119 119
             $this->database = $database;
120 120
         } else {
121 121
             $this->database = $database;
122 122
         }
123 123
 
124
-        if (!empty($this->instance)){
124
+        if (!empty($this->instance)) {
125 125
             $this->executeSQL("USE {$this->getDatabase()}");
126 126
         }
127 127
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             $prepare = empty($prepare) ? $this->getPrepare() : $prepare;
249 249
             return $prepare->rowCount();
250 250
         } catch (PDOException $e) {
251
-            $this->setError($e);}
251
+            $this->setError($e); }
252 252
     }
253 253
 
254 254
     /**
Please login to merge, or discard this patch.
example/ExampleDao.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
     public function findName(): array {
16 16
         $this->selectBuilder()
17
-            ->where("NOME=?",["Joao"])
17
+            ->where("NOME=?", ["Joao"])
18 18
             ->orderBy("NOME")
19 19
             ->executeQuery()
20 20
             ->fetchArrayAssoc();
Please login to merge, or discard this patch.
src/CrudBuilder.php 1 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, $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, $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.
rector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 use Rector\Config\RectorConfig;
7 7
 use Rector\Set\ValueObject\LevelSetList;
8 8
 
9
-return static function (RectorConfig $rectorConfig): void {
9
+return static function(RectorConfig $rectorConfig): void {
10 10
     $rectorConfig->paths([
11 11
         __DIR__ . '/example',
12 12
         __DIR__ . '/src',
Please login to merge, or discard this patch.
src/ModelAbstract.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function __get($name)
37 37
     {
38
-        return $this->{$name} ?? ($this->dataModelArray[$name]?? "");
38
+        return $this->{$name} ?? ($this->dataModelArray[$name] ?? "");
39 39
     }
40 40
 
41 41
     /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function __set($key, $value): void
47 47
     {
48
-        if (property_exists($this, $key)){
48
+        if (property_exists($this, $key)) {
49 49
             $this->{$key} = $value;
50 50
         }
51 51
         $this->dataModelArray[$key] = $value;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     function __isset($key) {
59 59
 
60 60
         $result = isset($this->dataModelArray[$key]);
61
-        if (property_exists($this, $key)){
61
+        if (property_exists($this, $key)) {
62 62
             $result = isset($this->{$key});
63 63
         }
64 64
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     {
81 81
         foreach ($params as $key => $item) {
82 82
             $this->dataModelArray[$key] = $item;
83
-            if (property_exists($this, $key)){
83
+            if (property_exists($this, $key)) {
84 84
                 $this->{$key} = $item;
85 85
             }
86 86
         }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         if (is_array($data) || is_object($data)) {
107 107
             $result = [];
108 108
             foreach ($data as $key => $value) {
109
-                if(strlen($value) > 0)
109
+                if (strlen($value)>0)
110 110
                     $result[$key] = (is_array($value) || is_object($value)) ? $this->toMap($value) : $value;
111 111
             }
112 112
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         }
138 138
 
139 139
         return $classname . ' {' . implode(', ', array_map(
140
-                function ($p_0) use ($data) {
140
+                function($p_0) use ($data) {
141 141
                     $p_0->setAccessible(true);
142 142
 
143 143
                     return $p_0->getName() . ': ' . $p_0->getValue($data);
Please login to merge, or discard this patch.
src/Crud.php 1 patch
Spacing   +7 added lines, -7 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);
@@ -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);
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
         $objeto = new \stdClass; 
253 253
 
254 254
         foreach ($reflection->getProperties() as $prop) {
255
-            $method = 'get'.$prop->name ; 
256
-            $objeto->{$prop->name} =  call_user_func([$model, $method]); 
255
+            $method = 'get' . $prop->name; 
256
+            $objeto->{$prop->name} = call_user_func([$model, $method]); 
257 257
             
258 258
         }
259 259
 
260
-        return $objeto ; 
260
+        return $objeto; 
261 261
 
262 262
 
263 263
     }
Please login to merge, or discard this patch.