Completed
Push — master ( 3d203f...f18ebe )
by Lars
02:19
created
src/voku/db/Debug.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         } else {
114 114
 
115 115
             // for testing with dev-address
116
-            $noDev = isset($_GET['noDev']) ? (int) $_GET['noDev'] : 0;
116
+            $noDev = isset($_GET['noDev']) ? (int)$_GET['noDev'] : 0;
117 117
             $remoteIpAddress = $_SERVER['REMOTE_ADDR'] ?? false;
118 118
 
119 119
             if (
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     {
162 162
         $fileInfo = $this->getFileAndLineFromSql();
163 163
 
164
-        $log = '[' . \date('Y-m-d H:i:s') . ']: SQL-Error: ' . $error . ' | Trace: ' . $fileInfo['path'] . '<br>';
164
+        $log = '['.\date('Y-m-d H:i:s').']: SQL-Error: '.$error.' | Trace: '.$fileInfo['path'].'<br>';
165 165
 
166 166
         $this->logger(['error', $log]);
167 167
 
@@ -177,17 +177,17 @@  discard block
 block discarded – undo
177 177
 
178 178
             if (\PHP_SAPI === 'cli') {
179 179
                 echo "\n";
180
-                echo 'Error: ' . $error . "\n";
181
-                echo 'Trace: ' . $fileInfo['path'] . "\n";
180
+                echo 'Error: '.$error."\n";
181
+                echo 'Trace: '.$fileInfo['path']."\n";
182 182
                 echo "\n";
183 183
             } else {
184 184
                 echo '
185
-                <div class="OBJ-mysql-box" style="border: ' . $box_border . '; background: ' . $box_bg . '; padding: 10px; margin: 10px;">
185
+                <div class="OBJ-mysql-box" style="border: ' . $box_border.'; background: '.$box_bg.'; padding: 10px; margin: 10px;">
186 186
                   <b style="font-size: 14px;">MYSQL Error:</b>
187 187
                   <code style="display: block;">
188
-                    Error:' . $error . '
188
+                    Error:' . $error.'
189 189
                     <br><br>
190
-                    Trace: ' . $fileInfo['path'] . '
190
+                    Trace: ' . $fileInfo['path'].'
191 191
                   </code>
192 192
                 </div>
193 193
                 ';
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                 continue;
243 243
             }
244 244
 
245
-            $path .= ($referrer[$key]['class'] ?? $referrer[$key]['file']) . '::' . ($referrer[$key]['function'] ?? '') . ':' . ($referrer[$key - 1]['line'] ?? '') . ' <- ';
245
+            $path .= ($referrer[$key]['class'] ?? $referrer[$key]['file']).'::'.($referrer[$key]['function'] ?? '').':'.($referrer[$key - 1]['line'] ?? '').' <- ';
246 246
         }
247 247
 
248 248
         $return['path'] = $path;
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
                 /** @noinspection PhpUsageOfSilenceOperatorInspection */
323 323
                 $traceStringExtra = @\mysqli_info($tmpLink);
324 324
                 if ($traceStringExtra) {
325
-                    $traceStringExtra = ' | info => ' . $traceStringExtra;
325
+                    $traceStringExtra = ' | info => '.$traceStringExtra;
326 326
                 }
327 327
             }
328 328
 
329
-            $traceStringExtra = ' | results => ' . \print_r($results, true) . $traceStringExtra;
329
+            $traceStringExtra = ' | results => '.\print_r($results, true).$traceStringExtra;
330 330
         }
331 331
 
332 332
         static $SLOW_QUERY_WARNING = null;
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
             $queryStatus = ' ERROR (REPEAT) ';
355 355
         }
356 356
 
357
-        $queryLog = '[' . \date('Y-m-d H:i:s') . ']: ' . $queryStatus . ' Duration: SQL::::DURATION-START' . \round($duration, 5) . 'SQL::::DURATION-END | Repeat: ' . $QUERY_LOG_FILE_INFO[$cacheKey] . ' | Host: ' . $this->_db->getConfig()['hostname'] . ' | Trace: ' . $fileInfo['path'] . ' | SQL: SQL::::QUERY-START ' . \str_replace("\n", '', $sql) . ' SQL::::QUERY-END' . $traceStringExtra . "\n";
357
+        $queryLog = '['.\date('Y-m-d H:i:s').']: '.$queryStatus.' Duration: SQL::::DURATION-START'.\round($duration, 5).'SQL::::DURATION-END | Repeat: '.$QUERY_LOG_FILE_INFO[$cacheKey].' | Host: '.$this->_db->getConfig()['hostname'].' | Trace: '.$fileInfo['path'].' | SQL: SQL::::QUERY-START '.\str_replace("\n", '', $sql).' SQL::::QUERY-END'.$traceStringExtra."\n";
358 358
 
359 359
         return $this->logger([$logLevel, $queryLog, 'sql']);
360 360
     }
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
             mailToAdmin($subject, $htmlBody, $priority);
426 426
         } else {
427 427
             if ($priority === 3) {
428
-                $this->logger(['debug', $subject . ' | ' . $htmlBody]);
428
+                $this->logger(['debug', $subject.' | '.$htmlBody]);
429 429
             } elseif ($priority > 3) {
430
-                $this->logger(['error', $subject . ' | ' . $htmlBody]);
430
+                $this->logger(['error', $subject.' | '.$htmlBody]);
431 431
             } elseif ($priority < 3) {
432
-                $this->logger(['info', $subject . ' | ' . $htmlBody]);
432
+                $this->logger(['info', $subject.' | '.$htmlBody]);
433 433
             }
434 434
         }
435 435
     }
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
      */
440 440
     public function setEchoOnError($echo_on_error)
441 441
     {
442
-        $this->echo_on_error = (bool) $echo_on_error;
442
+        $this->echo_on_error = (bool)$echo_on_error;
443 443
     }
444 444
 
445 445
     /**
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
      */
448 448
     public function setExitOnError($exit_on_error)
449 449
     {
450
-        $this->exit_on_error = (bool) $exit_on_error;
450
+        $this->exit_on_error = (bool)$exit_on_error;
451 451
     }
452 452
 
453 453
     /**
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
      */
456 456
     public function setLoggerClassName($logger_class_name)
457 457
     {
458
-        $this->logger_class_name = (string) $logger_class_name;
458
+        $this->logger_class_name = (string)$logger_class_name;
459 459
     }
460 460
 
461 461
     /**
@@ -463,6 +463,6 @@  discard block
 block discarded – undo
463 463
      */
464 464
     public function setLoggerLevel($logger_level)
465 465
     {
466
-        $this->logger_level = (string) $logger_level;
466
+        $this->logger_level = (string)$logger_level;
467 467
     }
468 468
 }
Please login to merge, or discard this patch.
src/voku/db/Result.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             &&
149 149
             !$result instanceof \Doctrine\DBAL\Statement
150 150
         ) {
151
-            throw new \InvalidArgumentException('$result must be ' . \mysqli_result::class . ' or ' . \Doctrine\DBAL\Statement::class . ' !');
151
+            throw new \InvalidArgumentException('$result must be '.\mysqli_result::class.' or '.\Doctrine\DBAL\Statement::class.' !');
152 152
         }
153 153
 
154 154
         $this->_result = $result;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
             $this->num_rows = $this->_result->rowCount();
172 172
         } else {
173
-            $this->num_rows = (int) $this->_result->num_rows;
173
+            $this->num_rows = (int)$this->_result->num_rows;
174 174
         }
175 175
 
176 176
         $this->current_row = 0;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      */
212 212
     public function __toString()
213 213
     {
214
-        return (string) $this->num_rows;
214
+        return (string)$this->num_rows;
215 215
     }
216 216
 
217 217
     /**
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         }
528 528
 
529 529
         return Arrayy::createFromGeneratorFunction(
530
-            function () {
530
+            function() {
531 531
                 $this->reset();
532 532
 
533 533
                 /** @noinspection PhpAssignmentInConditionInspection */
@@ -867,8 +867,8 @@  discard block
 block discarded – undo
867 867
 
868 868
         if ($as_array) {
869 869
             $fields = \array_map(
870
-                static function ($object) {
871
-                    return (array) $object;
870
+                static function($object) {
871
+                    return (array)$object;
872 872
                 },
873 873
                 $fields
874 874
             );
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
         }
1049 1049
 
1050 1050
         return \array_map(
1051
-            static function ($values) use ($keys) {
1051
+            static function($values) use ($keys) {
1052 1052
                 return \array_combine($keys, $values);
1053 1053
             },
1054 1054
             $rows
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
                     $fieldTmp->{$metadataTmpKey} = $metadataTmpValue;
1196 1196
                 }
1197 1197
 
1198
-                $typeNativeTmp = 'MYSQL_TYPE_' . $metadataTmp['native_type'];
1198
+                $typeNativeTmp = 'MYSQL_TYPE_'.$metadataTmp['native_type'];
1199 1199
                 $typeTmp = $THIS_CLASS_TMP->getConstant($typeNativeTmp);
1200 1200
                 if ($typeTmp) {
1201 1201
                     $fieldTmp->type = $typeTmp;
@@ -1549,11 +1549,11 @@  discard block
 block discarded – undo
1549 1549
             if (\abs($offset) > $this->num_rows) {
1550 1550
                 $offset = 0;
1551 1551
             } else {
1552
-                $offset = $this->num_rows - (int) \abs($offset);
1552
+                $offset = $this->num_rows - (int)\abs($offset);
1553 1553
             }
1554 1554
         }
1555 1555
 
1556
-        $length = $length !== null ? (int) $length : $this->num_rows;
1556
+        $length = $length !== null ? (int)$length : $this->num_rows;
1557 1557
         $n = 0;
1558 1558
         for ($i = $offset; $i < $this->num_rows && $n < $length; $i++) {
1559 1559
             if ($preserve_keys) {
Please login to merge, or discard this patch.