@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | $value = $this->_db->escape($value); |
| 103 | 103 | |
| 104 | 104 | if ($type === 's') { |
| 105 | - $valueForSqlWithBoundParameters = "'" . $value . "'"; |
|
| 105 | + $valueForSqlWithBoundParameters = "'".$value."'"; |
|
| 106 | 106 | } elseif ($type === 'i') { |
| 107 | - $valueForSqlWithBoundParameters = (int) $value; |
|
| 107 | + $valueForSqlWithBoundParameters = (int)$value; |
|
| 108 | 108 | } elseif ($type === 'd') { |
| 109 | - $valueForSqlWithBoundParameters = (float) $value; |
|
| 109 | + $valueForSqlWithBoundParameters = (float)$value; |
|
| 110 | 110 | } else { |
| 111 | 111 | $valueForSqlWithBoundParameters = $value; |
| 112 | 112 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | // "INSERT" || "REPLACE" |
| 207 | 207 | if (\preg_match('/^\s*"?(INSERT|REPLACE)\s+/i', $this->_sql)) { |
| 208 | - $insert_id = (int) $this->insert_id; |
|
| 208 | + $insert_id = (int)$this->insert_id; |
|
| 209 | 209 | $this->_debug->logQuery($this->_sql_with_bound_parameters, $query_duration, $insert_id); |
| 210 | 210 | |
| 211 | 211 | return $insert_id; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | // "UPDATE" || "DELETE" |
| 215 | 215 | if (\preg_match('/^\s*"?(UPDATE|DELETE)\s+/i', $this->_sql)) { |
| 216 | - $affected_rows = (int) $this->affected_rows; |
|
| 216 | + $affected_rows = (int)$this->affected_rows; |
|
| 217 | 217 | $this->_debug->logQuery($this->_sql_with_bound_parameters, $query_duration, $affected_rows); |
| 218 | 218 | |
| 219 | 219 | return $affected_rows; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | // "SELECT" |
| 223 | 223 | if (\preg_match('/^\s*"?(SELECT)\s+/i', $this->_sql)) { |
| 224 | 224 | $result = $this->get_result(); |
| 225 | - $num_rows = (int) $result->num_rows; |
|
| 225 | + $num_rows = (int)$result->num_rows; |
|
| 226 | 226 | $this->_debug->logQuery($this->_sql_with_bound_parameters, $query_duration, $num_rows); |
| 227 | 227 | |
| 228 | 228 | return new Result($this->_sql_with_bound_parameters, $result); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $bool = parent::prepare($query); |
| 296 | 296 | |
| 297 | 297 | if ($bool === false) { |
| 298 | - $this->_debug->displayError('Can not prepare query: ' . $query . ' | ' . $this->error, false); |
|
| 298 | + $this->_debug->displayError('Can not prepare query: '.$query.' | '.$this->error, false); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | return $bool; |
@@ -383,12 +383,12 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | // exit if we have more then 3 "DB server has gone away"-errors |
| 385 | 385 | if ($RECONNECT_COUNTER > 3) { |
| 386 | - $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMsg . ":\n<br />" . $sql, 5); |
|
| 386 | + $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMsg.":\n<br />".$sql, 5); |
|
| 387 | 387 | |
| 388 | 388 | throw new DBGoneAwayException($errorMsg); |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - $this->_debug->mailToAdmin('DB-Error', $errorMsg . ":\n<br />" . $sql); |
|
| 391 | + $this->_debug->mailToAdmin('DB-Error', $errorMsg.":\n<br />".$sql); |
|
| 392 | 392 | |
| 393 | 393 | // reconnect |
| 394 | 394 | $RECONNECT_COUNTER++; |
@@ -398,10 +398,10 @@ discard block |
||
| 398 | 398 | return $this->execute(); |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | - $this->_debug->mailToAdmin('SQL-Error', $errorMsg . ":\n<br />" . $sql); |
|
| 401 | + $this->_debug->mailToAdmin('SQL-Error', $errorMsg.":\n<br />".$sql); |
|
| 402 | 402 | |
| 403 | 403 | // this query returned an error, we must display it (only for dev) !!! |
| 404 | - $this->_debug->displayError($errorMsg . ' | ' . $sql); |
|
| 404 | + $this->_debug->displayError($errorMsg.' | '.$sql); |
|
| 405 | 405 | |
| 406 | 406 | return false; |
| 407 | 407 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 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; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $this->num_rows = $this->_result->rowCount(); |
| 180 | 180 | } else { |
| 181 | - $this->num_rows = (int) $this->_result->num_rows; |
|
| 181 | + $this->num_rows = (int)$this->_result->num_rows; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $this->current_row = 0; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | public function __toString() |
| 221 | 221 | { |
| 222 | - return (string) $this->num_rows; |
|
| 222 | + return (string)$this->num_rows; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -832,8 +832,8 @@ discard block |
||
| 832 | 832 | { |
| 833 | 833 | if ($as_array) { |
| 834 | 834 | return \array_map( |
| 835 | - function ($object) { |
|
| 836 | - return (array) $object; |
|
| 835 | + function($object) { |
|
| 836 | + return (array)$object; |
|
| 837 | 837 | }, |
| 838 | 838 | $this->fetch_fields() |
| 839 | 839 | ); |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | } |
| 998 | 998 | |
| 999 | 999 | return \array_map( |
| 1000 | - function ($values) use ($keys) { |
|
| 1000 | + function($values) use ($keys) { |
|
| 1001 | 1001 | return \array_combine($keys, $values); |
| 1002 | 1002 | }, |
| 1003 | 1003 | $rows |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | $fieldTmp->{$metadataTmpKey} = $metadataTmpValue; |
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | - $typeNativeTmp = 'MYSQL_TYPE_' . $metadataTmp['native_type']; |
|
| 1136 | + $typeNativeTmp = 'MYSQL_TYPE_'.$metadataTmp['native_type']; |
|
| 1137 | 1137 | $typeTmp = $THIS_CLASS_TMP->getConstant($typeNativeTmp); |
| 1138 | 1138 | if ($typeTmp) { |
| 1139 | 1139 | $fieldTmp->type = $typeTmp; |
@@ -1492,11 +1492,11 @@ discard block |
||
| 1492 | 1492 | if (\abs($offset) > $this->num_rows) { |
| 1493 | 1493 | $offset = 0; |
| 1494 | 1494 | } else { |
| 1495 | - $offset = $this->num_rows - (int) \abs($offset); |
|
| 1495 | + $offset = $this->num_rows - (int)\abs($offset); |
|
| 1496 | 1496 | } |
| 1497 | 1497 | } |
| 1498 | 1498 | |
| 1499 | - $length = $length !== null ? (int) $length : $this->num_rows; |
|
| 1499 | + $length = $length !== null ? (int)$length : $this->num_rows; |
|
| 1500 | 1500 | $n = 0; |
| 1501 | 1501 | for ($i = $offset; $i < $this->num_rows && $n < $length; $i++) { |
| 1502 | 1502 | if ($preserve_keys) { |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $optimized = 0; |
| 30 | 30 | if (!empty($tables)) { |
| 31 | 31 | foreach ($tables as $table) { |
| 32 | - $optimize = 'OPTIMIZE TABLE ' . $dbConnection->quote_string($table); |
|
| 32 | + $optimize = 'OPTIMIZE TABLE '.$dbConnection->quote_string($table); |
|
| 33 | 33 | $result = $dbConnection->query($optimize); |
| 34 | 34 | if ($result) { |
| 35 | 35 | $optimized++; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $optimized = 0; |
| 58 | 58 | if (!empty($tables)) { |
| 59 | 59 | foreach ($tables as $table) { |
| 60 | - $optimize = 'REPAIR TABLE ' . $dbConnection->quote_string($table); |
|
| 60 | + $optimize = 'REPAIR TABLE '.$dbConnection->quote_string($table); |
|
| 61 | 61 | $result = $dbConnection->query($optimize); |
| 62 | 62 | if ($result) { |
| 63 | 63 | $optimized++; |
@@ -177,23 +177,23 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | $whereSQL = $dbConnection->_parseArrayPair($whereArray, 'AND'); |
| 179 | 179 | if ($whereSQL) { |
| 180 | - $whereSQL = 'AND ' . $whereSQL; |
|
| 180 | + $whereSQL = 'AND '.$whereSQL; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | if ($databaseName) { |
| 184 | - $databaseName = $dbConnection->quote_string(\trim($databaseName)) . '.'; |
|
| 184 | + $databaseName = $dbConnection->quote_string(\trim($databaseName)).'.'; |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | // get the row |
| 188 | - $query = 'SELECT ' . $dbConnection->quote_string($searchFieldName) . ', ' . $dbConnection->quote_string($idFieldName) . ' |
|
| 189 | - FROM ' . $databaseName . $dbConnection->quote_string($table) . ' |
|
| 188 | + $query = 'SELECT '.$dbConnection->quote_string($searchFieldName).', '.$dbConnection->quote_string($idFieldName).' |
|
| 189 | + FROM ' . $databaseName.$dbConnection->quote_string($table).' |
|
| 190 | 190 | WHERE 1 = 1 |
| 191 | - ' . $whereSQL . ' |
|
| 191 | + ' . $whereSQL.' |
|
| 192 | 192 | '; |
| 193 | 193 | |
| 194 | 194 | if ($useCache === true) { |
| 195 | 195 | $cache = new Cache(null, null, false, $useCache); |
| 196 | - $cacheKey = 'sql-phonetic-search-' . \md5($query); |
|
| 196 | + $cacheKey = 'sql-phonetic-search-'.\md5($query); |
|
| 197 | 197 | |
| 198 | 198 | if ( |
| 199 | 199 | $cache->getCacheIsReady() === true |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - return $MYSQL_CLIENT_VERSION_CACHE[$cacheKey] = (string) \mysqli_get_client_version($dbConnection->getLink()); |
|
| 271 | + return $MYSQL_CLIENT_VERSION_CACHE[$cacheKey] = (string)\mysqli_get_client_version($dbConnection->getLink()); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
@@ -296,11 +296,11 @@ discard block |
||
| 296 | 296 | if ($doctrineConnection) { |
| 297 | 297 | $doctrineWrappedConnection = $doctrineConnection->getWrappedConnection(); |
| 298 | 298 | if ($doctrineWrappedConnection instanceof \Doctrine\DBAL\Driver\PDOConnection) { |
| 299 | - return $MYSQL_SERVER_VERSION_CACHE[$cacheKey] = (string) $doctrineWrappedConnection->getServerVersion(); |
|
| 299 | + return $MYSQL_SERVER_VERSION_CACHE[$cacheKey] = (string)$doctrineWrappedConnection->getServerVersion(); |
|
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - return $MYSQL_SERVER_VERSION_CACHE[$cacheKey] = (string) \mysqli_get_server_version($dbConnection->getLink()); |
|
| 303 | + return $MYSQL_SERVER_VERSION_CACHE[$cacheKey] = (string)\mysqli_get_server_version($dbConnection->getLink()); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | /** |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | if ($databaseName) { |
| 344 | - $databaseName = $dbConnection->quote_string(\trim($databaseName)) . '.'; |
|
| 344 | + $databaseName = $dbConnection->quote_string(\trim($databaseName)).'.'; |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - $sql = 'SHOW COLUMNS FROM ' . $databaseName . $dbConnection->escape($table); |
|
| 347 | + $sql = 'SHOW COLUMNS FROM '.$databaseName.$dbConnection->escape($table); |
|
| 348 | 348 | $result = $dbConnection->query($sql); |
| 349 | 349 | |
| 350 | 350 | if ($result && $result->num_rows > 0) { |
@@ -390,17 +390,17 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | $whereSQL = $dbConnection->_parseArrayPair($whereArray, 'AND'); |
| 392 | 392 | if ($whereSQL) { |
| 393 | - $whereSQL = 'AND ' . $whereSQL; |
|
| 393 | + $whereSQL = 'AND '.$whereSQL; |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | if ($databaseName) { |
| 397 | - $databaseName = $dbConnection->quote_string(\trim($databaseName)) . '.'; |
|
| 397 | + $databaseName = $dbConnection->quote_string(\trim($databaseName)).'.'; |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | // get the row |
| 401 | - $query = 'SELECT * FROM ' . $databaseName . $dbConnection->quote_string($table) . ' |
|
| 401 | + $query = 'SELECT * FROM '.$databaseName.$dbConnection->quote_string($table).' |
|
| 402 | 402 | WHERE 1 = 1 |
| 403 | - ' . $whereSQL . ' |
|
| 403 | + ' . $whereSQL.' |
|
| 404 | 404 | '; |
| 405 | 405 | $result = $dbConnection->query($query); |
| 406 | 406 | |
@@ -419,11 +419,11 @@ discard block |
||
| 419 | 419 | foreach ($tmpArray as $fieldName => $value) { |
| 420 | 420 | if (!\in_array($fieldName, $ignoreArray, true)) { |
| 421 | 421 | if (\array_key_exists($fieldName, $updateArray)) { |
| 422 | - $insert_keys .= ',' . $fieldName; |
|
| 422 | + $insert_keys .= ','.$fieldName; |
|
| 423 | 423 | $insert_values .= ',?'; |
| 424 | 424 | $bindings[] = $updateArray[$fieldName]; // INFO: do not escape non selected data |
| 425 | 425 | } else { |
| 426 | - $insert_keys .= ',' . $fieldName; |
|
| 426 | + $insert_keys .= ','.$fieldName; |
|
| 427 | 427 | $insert_values .= ',?'; |
| 428 | 428 | $bindings[] = $value; // INFO: do not escape non selected data |
| 429 | 429 | } |
@@ -434,10 +434,10 @@ discard block |
||
| 434 | 434 | $insert_values = \ltrim($insert_values, ','); |
| 435 | 435 | |
| 436 | 436 | // insert the "copied" row |
| 437 | - $new_query = 'INSERT INTO ' . $databaseName . $dbConnection->quote_string($table) . ' |
|
| 438 | - (' . $insert_keys . ') |
|
| 437 | + $new_query = 'INSERT INTO '.$databaseName.$dbConnection->quote_string($table).' |
|
| 438 | + (' . $insert_keys.') |
|
| 439 | 439 | VALUES |
| 440 | - (' . $insert_values . ') |
|
| 440 | + (' . $insert_values.') |
|
| 441 | 441 | '; |
| 442 | 442 | |
| 443 | 443 | return $dbConnection->query($new_query, $bindings); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } else { |
| 87 | 87 | |
| 88 | 88 | // for testing with dev-address |
| 89 | - $noDev = isset($_GET['noDev']) ? (int) $_GET['noDev'] : 0; |
|
| 89 | + $noDev = isset($_GET['noDev']) ? (int)$_GET['noDev'] : 0; |
|
| 90 | 90 | $remoteIpAddress = $_SERVER['REMOTE_ADDR'] ?? false; |
| 91 | 91 | |
| 92 | 92 | if ( |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | $this->logger( |
| 138 | 138 | [ |
| 139 | 139 | 'error', |
| 140 | - '<strong>' . \date( |
|
| 140 | + '<strong>'.\date( |
|
| 141 | 141 | 'd. m. Y G:i:s' |
| 142 | - ) . ' (' . $fileInfo['file'] . ' line: ' . $fileInfo['line'] . ') (sql-error):</strong> ' . $error . '<br>', |
|
| 142 | + ).' ('.$fileInfo['file'].' line: '.$fileInfo['line'].') (sql-error):</strong> '.$error.'<br>', |
|
| 143 | 143 | ] |
| 144 | 144 | ); |
| 145 | 145 | |
@@ -155,16 +155,16 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | if (\PHP_SAPI === 'cli') { |
| 157 | 157 | echo "\n"; |
| 158 | - echo 'file:line -> ' . $fileInfo['file'] . ':' . $fileInfo['line'] . "\n"; |
|
| 159 | - echo 'error: ' . \str_replace(["\r\n", "\n", "\r"], '', $error); |
|
| 158 | + echo 'file:line -> '.$fileInfo['file'].':'.$fileInfo['line']."\n"; |
|
| 159 | + echo 'error: '.\str_replace(["\r\n", "\n", "\r"], '', $error); |
|
| 160 | 160 | echo "\n"; |
| 161 | 161 | } else { |
| 162 | 162 | echo ' |
| 163 | - <div class="OBJ-mysql-box" style="border: ' . $box_border . '; background: ' . $box_bg . '; padding: 10px; margin: 10px;"> |
|
| 163 | + <div class="OBJ-mysql-box" style="border: ' . $box_border.'; background: '.$box_bg.'; padding: 10px; margin: 10px;"> |
|
| 164 | 164 | <b style="font-size: 14px;">MYSQL Error:</b> |
| 165 | 165 | <code style="display: block;"> |
| 166 | - file:line -> ' . $fileInfo['file'] . ':' . $fileInfo['line'] . ' |
|
| 167 | - ' . $error . ' |
|
| 166 | + file:line -> ' . $fileInfo['file'].':'.$fileInfo['line'].' |
|
| 167 | + ' . $error.' |
|
| 168 | 168 | </code> |
| 169 | 169 | </div> |
| 170 | 170 | '; |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 305 | 305 | $infoExtra = @\mysqli_info($tmpLink); |
| 306 | 306 | if ($infoExtra) { |
| 307 | - $infoExtra = ' | info => ' . $infoExtra; |
|
| 307 | + $infoExtra = ' | info => '.$infoExtra; |
|
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | |
@@ -312,14 +312,14 @@ discard block |
||
| 312 | 312 | // logging |
| 313 | 313 | // |
| 314 | 314 | |
| 315 | - $info = 'time => ' . \round($duration, 5) . ' | results => ' . (int) $results . $infoExtra . ' | SQL => ' . UTF8::htmlentities($sql); |
|
| 315 | + $info = 'time => '.\round($duration, 5).' | results => '.(int)$results.$infoExtra.' | SQL => '.UTF8::htmlentities($sql); |
|
| 316 | 316 | |
| 317 | 317 | $fileInfo = $this->getFileAndLineFromSql(); |
| 318 | 318 | |
| 319 | 319 | return $this->logger( |
| 320 | 320 | [ |
| 321 | 321 | $logLevel, |
| 322 | - '<strong>' . \date('d. m. Y G:i:s') . ' (' . $fileInfo['file'] . ' line: ' . $fileInfo['line'] . '):</strong> ' . $info . '<br>', |
|
| 322 | + '<strong>'.\date('d. m. Y G:i:s').' ('.$fileInfo['file'].' line: '.$fileInfo['line'].'):</strong> '.$info.'<br>', |
|
| 323 | 323 | 'sql', |
| 324 | 324 | ] |
| 325 | 325 | ); |
@@ -384,21 +384,21 @@ discard block |
||
| 384 | 384 | $this->logger( |
| 385 | 385 | [ |
| 386 | 386 | 'debug', |
| 387 | - $subject . ' | ' . $htmlBody, |
|
| 387 | + $subject.' | '.$htmlBody, |
|
| 388 | 388 | ] |
| 389 | 389 | ); |
| 390 | 390 | } elseif ($priority > 3) { |
| 391 | 391 | $this->logger( |
| 392 | 392 | [ |
| 393 | 393 | 'error', |
| 394 | - $subject . ' | ' . $htmlBody, |
|
| 394 | + $subject.' | '.$htmlBody, |
|
| 395 | 395 | ] |
| 396 | 396 | ); |
| 397 | 397 | } elseif ($priority < 3) { |
| 398 | 398 | $this->logger( |
| 399 | 399 | [ |
| 400 | 400 | 'info', |
| 401 | - $subject . ' | ' . $htmlBody, |
|
| 401 | + $subject.' | '.$htmlBody, |
|
| 402 | 402 | ] |
| 403 | 403 | ); |
| 404 | 404 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | */ |
| 411 | 411 | public function setEchoOnError($echo_on_error) |
| 412 | 412 | { |
| 413 | - $this->echo_on_error = (bool) $echo_on_error; |
|
| 413 | + $this->echo_on_error = (bool)$echo_on_error; |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /** |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | */ |
| 419 | 419 | public function setExitOnError($exit_on_error) |
| 420 | 420 | { |
| 421 | - $this->exit_on_error = (bool) $exit_on_error; |
|
| 421 | + $this->exit_on_error = (bool)$exit_on_error; |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | /** |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | */ |
| 427 | 427 | public function setLoggerClassName($logger_class_name) |
| 428 | 428 | { |
| 429 | - $this->logger_class_name = (string) $logger_class_name; |
|
| 429 | + $this->logger_class_name = (string)$logger_class_name; |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | /** |
@@ -434,6 +434,6 @@ discard block |
||
| 434 | 434 | */ |
| 435 | 435 | public function setLoggerLevel($logger_level) |
| 436 | 436 | { |
| 437 | - $this->logger_level = (string) $logger_level; |
|
| 437 | + $this->logger_level = (string)$logger_level; |
|
| 438 | 438 | } |
| 439 | 439 | } |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if ($port) { |
| 300 | - $this->port = (int) $port; |
|
| 300 | + $this->port = (int)$port; |
|
| 301 | 301 | } else { |
| 302 | 302 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 303 | - $this->port = (int) @\ini_get('mysqli.default_port'); |
|
| 303 | + $this->port = (int)@\ini_get('mysqli.default_port'); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | // fallback |
@@ -429,18 +429,18 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | if ($_connector === 'NOT IN' || $_connector === 'IN') { |
| 432 | - $_value = '(' . \implode(',', $_value) . ')'; |
|
| 432 | + $_value = '('.\implode(',', $_value).')'; |
|
| 433 | 433 | } elseif ($_connector === 'NOT BETWEEN' || $_connector === 'BETWEEN') { |
| 434 | - $_value = '(' . \implode(' AND ', $_value) . ')'; |
|
| 434 | + $_value = '('.\implode(' AND ', $_value).')'; |
|
| 435 | 435 | } elseif ($firstKey && $firstValue) { |
| 436 | 436 | if (\strpos($firstKey, ' +') !== false) { |
| 437 | 437 | $firstKey = \str_replace(' +', '', $firstKey); |
| 438 | - $_value = $firstKey . ' + ' . $firstValue; |
|
| 438 | + $_value = $firstKey.' + '.$firstValue; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | if (\strpos($firstKey, ' -') !== false) { |
| 442 | 442 | $firstKey = \str_replace(' -', '', $firstKey); |
| 443 | - $_value = $firstKey . ' - ' . $firstValue; |
|
| 443 | + $_value = $firstKey.' - '.$firstValue; |
|
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | } else { |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | ) |
| 461 | 461 | ); |
| 462 | 462 | |
| 463 | - $_value = (array) $_value; |
|
| 463 | + $_value = (array)$_value; |
|
| 464 | 464 | |
| 465 | 465 | if (!$_glueHelper) { |
| 466 | 466 | $_glueHelper = $glue; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | $valueInner = "''"; |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | - $sql .= ' ' . $_glueHelperInner . ' ' . $quoteString . ' ' . $_connector . ' ' . $valueInner . " \n"; |
|
| 487 | + $sql .= ' '.$_glueHelperInner.' '.$quoteString.' '.$_connector.' '.$valueInner." \n"; |
|
| 488 | 488 | $tmpCounter++; |
| 489 | 489 | } |
| 490 | 490 | |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | unset($params[$key]); |
| 536 | 536 | |
| 537 | 537 | $sql = \substr_replace($sql, $replacement, $offset, 1); |
| 538 | - $offset = \strpos($sql, '?', $offset + \strlen((string) $replacement)); |
|
| 538 | + $offset = \strpos($sql, '?', $offset + \strlen((string)$replacement)); |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | return ['sql' => $sql, 'params' => $params]; |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | |
| 572 | 572 | // add ":" if needed |
| 573 | 573 | if (\strpos($name, ':') !== 0) { |
| 574 | - $nameTmp = ':' . $name; |
|
| 574 | + $nameTmp = ':'.$name; |
|
| 575 | 575 | } else { |
| 576 | 576 | $nameTmp = $name; |
| 577 | 577 | } |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | if ($offset === null) { |
| 580 | 580 | $offset = \strpos($sql, $nameTmp); |
| 581 | 581 | } else { |
| 582 | - $offset = \strpos($sql, $nameTmp, $offset + \strlen((string) $replacement)); |
|
| 582 | + $offset = \strpos($sql, $nameTmp, $offset + \strlen((string)$replacement)); |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | if ($offset === false) { |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | return \mysqli_affected_rows($this->mysqli_link); |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | - return (int) $this->affected_rows; |
|
| 614 | + return (int)$this->affected_rows; |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | /** |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | $this->connected = $this->doctrine_connection->isConnected(); |
| 764 | 764 | |
| 765 | 765 | if (!$this->connected) { |
| 766 | - $error = 'Error connecting to mysql server: ' . $this->doctrine_connection->errorInfo(); |
|
| 766 | + $error = 'Error connecting to mysql server: '.$this->doctrine_connection->errorInfo(); |
|
| 767 | 767 | $this->debug->displayError($error, false); |
| 768 | 768 | |
| 769 | 769 | throw new DBConnectException($error, 101); |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | $this->connected = $this->doctrine_connection->isConnected(); |
| 781 | 781 | |
| 782 | 782 | if (!$this->connected) { |
| 783 | - $error = 'Error connecting to mysql server: ' . $this->doctrine_connection->errorInfo(); |
|
| 783 | + $error = 'Error connecting to mysql server: '.$this->doctrine_connection->errorInfo(); |
|
| 784 | 784 | $this->debug->displayError($error, false); |
| 785 | 785 | |
| 786 | 786 | throw new DBConnectException($error, 101); |
@@ -840,10 +840,10 @@ discard block |
||
| 840 | 840 | $this->database, |
| 841 | 841 | $this->port, |
| 842 | 842 | $this->socket, |
| 843 | - (int) $flags |
|
| 843 | + (int)$flags |
|
| 844 | 844 | ); |
| 845 | 845 | } catch (\Exception $e) { |
| 846 | - $error = 'Error connecting to mysql server: ' . $e->getMessage(); |
|
| 846 | + $error = 'Error connecting to mysql server: '.$e->getMessage(); |
|
| 847 | 847 | $this->debug->displayError($error, false); |
| 848 | 848 | |
| 849 | 849 | throw new DBConnectException($error, 100, $e); |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | |
| 853 | 853 | $errno = \mysqli_connect_errno(); |
| 854 | 854 | if (!$this->connected || $errno) { |
| 855 | - $error = 'Error connecting to mysql server: ' . \mysqli_connect_error() . ' (' . $errno . ')'; |
|
| 855 | + $error = 'Error connecting to mysql server: '.\mysqli_connect_error().' ('.$errno.')'; |
|
| 856 | 856 | $this->debug->displayError($error, false); |
| 857 | 857 | |
| 858 | 858 | throw new DBConnectException($error, 101); |
@@ -894,10 +894,10 @@ discard block |
||
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | if ($databaseName) { |
| 897 | - $databaseName = $this->quote_string(\trim($databaseName)) . '.'; |
|
| 897 | + $databaseName = $this->quote_string(\trim($databaseName)).'.'; |
|
| 898 | 898 | } |
| 899 | 899 | |
| 900 | - $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE (${WHERE})"; |
|
| 900 | + $sql = 'DELETE FROM '.$databaseName.$this->quote_string($table)." WHERE (${WHERE})"; |
|
| 901 | 901 | |
| 902 | 902 | return $this->query($sql); |
| 903 | 903 | } |
@@ -988,14 +988,14 @@ discard block |
||
| 988 | 988 | $var = $var->format('Y-m-d H:i:s'); |
| 989 | 989 | $type = 'string'; |
| 990 | 990 | } elseif (\method_exists($var, '__toString')) { |
| 991 | - $var = (string) $var; |
|
| 991 | + $var = (string)$var; |
|
| 992 | 992 | $type = 'string'; |
| 993 | 993 | } |
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | switch ($type) { |
| 997 | 997 | case 'boolean': |
| 998 | - $var = (int) $var; |
|
| 998 | + $var = (int)$var; |
|
| 999 | 999 | |
| 1000 | 1000 | break; |
| 1001 | 1001 | |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | } |
| 1037 | 1037 | } else { |
| 1038 | 1038 | $varCleaned = []; |
| 1039 | - foreach ((array) $var as $key => $value) { |
|
| 1039 | + foreach ((array)$var as $key => $value) { |
|
| 1040 | 1040 | $key = $this->escape($key, $stripe_non_utf8, $html_entity_decode); |
| 1041 | 1041 | $value = $this->escape($value, $stripe_non_utf8, $html_entity_decode); |
| 1042 | 1042 | |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | |
| 1100 | 1100 | if ($useCache === true) { |
| 1101 | 1101 | $cache = new Cache(null, null, false, $useCache); |
| 1102 | - $cacheKey = 'sql-' . \md5($query); |
|
| 1102 | + $cacheKey = 'sql-'.\md5($query); |
|
| 1103 | 1103 | |
| 1104 | 1104 | if ( |
| 1105 | 1105 | $cache->getCacheIsReady() === true |
@@ -1270,7 +1270,7 @@ discard block |
||
| 1270 | 1270 | } |
| 1271 | 1271 | |
| 1272 | 1272 | if ( |
| 1273 | - '' . $hostname . $username . $password . $database . $port . $charset === '' . $port . $charset |
|
| 1273 | + ''.$hostname.$username.$password.$database.$port.$charset === ''.$port.$charset |
|
| 1274 | 1274 | && |
| 1275 | 1275 | $firstInstance instanceof self |
| 1276 | 1276 | ) { |
@@ -1286,13 +1286,13 @@ discard block |
||
| 1286 | 1286 | if (\is_object($extra_config_value)) { |
| 1287 | 1287 | $extra_config_value_tmp = \spl_object_hash($extra_config_value); |
| 1288 | 1288 | } else { |
| 1289 | - $extra_config_value_tmp = (string) $extra_config_value; |
|
| 1289 | + $extra_config_value_tmp = (string)$extra_config_value; |
|
| 1290 | 1290 | } |
| 1291 | - $extra_config_string .= $extra_config_key . $extra_config_value_tmp; |
|
| 1291 | + $extra_config_string .= $extra_config_key.$extra_config_value_tmp; |
|
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | 1294 | $connection = \md5( |
| 1295 | - $hostname . $username . $password . $database . $port . $charset . (int) $exit_on_error . (int) $echo_on_error . $logger_class_name . $logger_level . $extra_config_string |
|
| 1295 | + $hostname.$username.$password.$database.$port.$charset.(int)$exit_on_error.(int)$echo_on_error.$logger_class_name.$logger_level.$extra_config_string |
|
| 1296 | 1296 | ); |
| 1297 | 1297 | |
| 1298 | 1298 | if (!isset($instance[$connection])) { |
@@ -1431,10 +1431,10 @@ discard block |
||
| 1431 | 1431 | $SET = $this->_parseArrayPair($data); |
| 1432 | 1432 | |
| 1433 | 1433 | if ($databaseName) { |
| 1434 | - $databaseName = $this->quote_string(\trim($databaseName)) . '.'; |
|
| 1434 | + $databaseName = $this->quote_string(\trim($databaseName)).'.'; |
|
| 1435 | 1435 | } |
| 1436 | 1436 | |
| 1437 | - $sql = 'INSERT INTO ' . $databaseName . $this->quote_string($table) . " SET ${SET}"; |
|
| 1437 | + $sql = 'INSERT INTO '.$databaseName.$this->quote_string($table)." SET ${SET}"; |
|
| 1438 | 1438 | |
| 1439 | 1439 | return $this->query($sql); |
| 1440 | 1440 | } |
@@ -1939,12 +1939,12 @@ discard block |
||
| 1939 | 1939 | |
| 1940 | 1940 | // exit if we have more then 3 "DB server has gone away"-errors |
| 1941 | 1941 | if ($RECONNECT_COUNTER > 3) { |
| 1942 | - $this->debug->mailToAdmin('DB-Fatal-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql, 5); |
|
| 1942 | + $this->debug->mailToAdmin('DB-Fatal-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql, 5); |
|
| 1943 | 1943 | |
| 1944 | 1944 | throw new DBGoneAwayException($errorMessage); |
| 1945 | 1945 | } |
| 1946 | 1946 | |
| 1947 | - $this->debug->mailToAdmin('DB-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql); |
|
| 1947 | + $this->debug->mailToAdmin('DB-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql); |
|
| 1948 | 1948 | |
| 1949 | 1949 | // reconnect |
| 1950 | 1950 | $RECONNECT_COUNTER++; |
@@ -1958,7 +1958,7 @@ discard block |
||
| 1958 | 1958 | return false; |
| 1959 | 1959 | } |
| 1960 | 1960 | |
| 1961 | - $this->debug->mailToAdmin('SQL-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql); |
|
| 1961 | + $this->debug->mailToAdmin('SQL-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql); |
|
| 1962 | 1962 | |
| 1963 | 1963 | $force_exception_after_error = null; // auto |
| 1964 | 1964 | if ($this->in_transaction === true) { |
@@ -1966,7 +1966,7 @@ discard block |
||
| 1966 | 1966 | } |
| 1967 | 1967 | // this query returned an error, we must display it (only for dev) !!! |
| 1968 | 1968 | |
| 1969 | - $this->debug->displayError($errorMessage . '(' . $errorNumber . ') ' . ' | ' . $sql, $force_exception_after_error); |
|
| 1969 | + $this->debug->displayError($errorMessage.'('.$errorNumber.') '.' | '.$sql, $force_exception_after_error); |
|
| 1970 | 1970 | |
| 1971 | 1971 | return false; |
| 1972 | 1972 | } |
@@ -1984,12 +1984,12 @@ discard block |
||
| 1984 | 1984 | '`', |
| 1985 | 1985 | '``', |
| 1986 | 1986 | \trim( |
| 1987 | - (string) $this->escape($str, false), |
|
| 1987 | + (string)$this->escape($str, false), |
|
| 1988 | 1988 | '`' |
| 1989 | 1989 | ) |
| 1990 | 1990 | ); |
| 1991 | 1991 | |
| 1992 | - return '`' . $str . '`'; |
|
| 1992 | + return '`'.$str.'`'; |
|
| 1993 | 1993 | } |
| 1994 | 1994 | |
| 1995 | 1995 | /** |
@@ -2059,10 +2059,10 @@ discard block |
||
| 2059 | 2059 | $values = \implode(',', $data); |
| 2060 | 2060 | |
| 2061 | 2061 | if ($databaseName) { |
| 2062 | - $databaseName = $this->quote_string(\trim($databaseName)) . '.'; |
|
| 2062 | + $databaseName = $this->quote_string(\trim($databaseName)).'.'; |
|
| 2063 | 2063 | } |
| 2064 | 2064 | |
| 2065 | - $sql = 'REPLACE INTO ' . $databaseName . $this->quote_string($table) . " (${columns}) VALUES (${values})"; |
|
| 2065 | + $sql = 'REPLACE INTO '.$databaseName.$this->quote_string($table)." (${columns}) VALUES (${values})"; |
|
| 2066 | 2066 | |
| 2067 | 2067 | return $this->query($sql); |
| 2068 | 2068 | } |
@@ -2154,7 +2154,7 @@ discard block |
||
| 2154 | 2154 | } |
| 2155 | 2155 | } else { |
| 2156 | 2156 | $varCleaned = []; |
| 2157 | - foreach ((array) $var as $key => $value) { |
|
| 2157 | + foreach ((array)$var as $key => $value) { |
|
| 2158 | 2158 | $key = $this->escape($key, false, false, $convert_array); |
| 2159 | 2159 | $value = $this->secure($value); |
| 2160 | 2160 | |
@@ -2201,7 +2201,7 @@ discard block |
||
| 2201 | 2201 | $var = $this->escape($var, false, false, null); |
| 2202 | 2202 | |
| 2203 | 2203 | if (\is_string($var)) { |
| 2204 | - $var = "'" . \trim($var, "'") . "'"; |
|
| 2204 | + $var = "'".\trim($var, "'")."'"; |
|
| 2205 | 2205 | } |
| 2206 | 2206 | |
| 2207 | 2207 | return $var; |
@@ -2238,10 +2238,10 @@ discard block |
||
| 2238 | 2238 | } |
| 2239 | 2239 | |
| 2240 | 2240 | if ($databaseName) { |
| 2241 | - $databaseName = $this->quote_string(\trim($databaseName)) . '.'; |
|
| 2241 | + $databaseName = $this->quote_string(\trim($databaseName)).'.'; |
|
| 2242 | 2242 | } |
| 2243 | 2243 | |
| 2244 | - $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE (${WHERE})"; |
|
| 2244 | + $sql = 'SELECT * FROM '.$databaseName.$this->quote_string($table)." WHERE (${WHERE})"; |
|
| 2245 | 2245 | |
| 2246 | 2246 | return $this->query($sql); |
| 2247 | 2247 | } |
@@ -2283,7 +2283,7 @@ discard block |
||
| 2283 | 2283 | public function setConfigExtra(array $extra_config) |
| 2284 | 2284 | { |
| 2285 | 2285 | if (isset($extra_config['session_to_db'])) { |
| 2286 | - $this->session_to_db = (bool) $extra_config['session_to_db']; |
|
| 2286 | + $this->session_to_db = (bool)$extra_config['session_to_db']; |
|
| 2287 | 2287 | } |
| 2288 | 2288 | |
| 2289 | 2289 | if (isset($extra_config['doctrine'])) { |
@@ -2342,14 +2342,14 @@ discard block |
||
| 2342 | 2342 | $return = \mysqli_set_charset($this->mysqli_link, $charset); |
| 2343 | 2343 | |
| 2344 | 2344 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 2345 | - @\mysqli_query($this->mysqli_link, 'SET CHARACTER SET ' . $charset); |
|
| 2345 | + @\mysqli_query($this->mysqli_link, 'SET CHARACTER SET '.$charset); |
|
| 2346 | 2346 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 2347 | - @\mysqli_query($this->mysqli_link, "SET NAMES '" . $charset . "'"); |
|
| 2347 | + @\mysqli_query($this->mysqli_link, "SET NAMES '".$charset."'"); |
|
| 2348 | 2348 | } elseif ($this->isDoctrinePDOConnection() === true) { |
| 2349 | 2349 | $doctrineWrappedConnection = $this->getDoctrinePDOConnection(); |
| 2350 | 2350 | |
| 2351 | - $doctrineWrappedConnection->exec('SET CHARACTER SET ' . $charset); |
|
| 2352 | - $doctrineWrappedConnection->exec("SET NAMES '" . $charset . "'"); |
|
| 2351 | + $doctrineWrappedConnection->exec('SET CHARACTER SET '.$charset); |
|
| 2352 | + $doctrineWrappedConnection->exec("SET NAMES '".$charset."'"); |
|
| 2353 | 2353 | |
| 2354 | 2354 | $return = true; |
| 2355 | 2355 | } else { |
@@ -2490,7 +2490,7 @@ discard block |
||
| 2490 | 2490 | */ |
| 2491 | 2491 | public function table_exists(string $table): bool |
| 2492 | 2492 | { |
| 2493 | - $check = $this->query('SELECT 1 FROM ' . $this->quote_string($table)); |
|
| 2493 | + $check = $this->query('SELECT 1 FROM '.$this->quote_string($table)); |
|
| 2494 | 2494 | |
| 2495 | 2495 | return $check !== false |
| 2496 | 2496 | && |
@@ -2520,7 +2520,7 @@ discard block |
||
| 2520 | 2520 | $result = $callback($this); |
| 2521 | 2521 | if ($result === false) { |
| 2522 | 2522 | /** @noinspection ThrowRawExceptionInspection */ |
| 2523 | - throw new \Exception('call_user_func [' . $callback . '] === false'); |
|
| 2523 | + throw new \Exception('call_user_func ['.$callback.'] === false'); |
|
| 2524 | 2524 | } |
| 2525 | 2525 | |
| 2526 | 2526 | return $this->commit(); |
@@ -2577,10 +2577,10 @@ discard block |
||
| 2577 | 2577 | } |
| 2578 | 2578 | |
| 2579 | 2579 | if ($databaseName) { |
| 2580 | - $databaseName = $this->quote_string(\trim($databaseName)) . '.'; |
|
| 2580 | + $databaseName = $this->quote_string(\trim($databaseName)).'.'; |
|
| 2581 | 2581 | } |
| 2582 | 2582 | |
| 2583 | - $sql = 'UPDATE ' . $databaseName . $this->quote_string($table) . " SET ${SET} WHERE (${WHERE})"; |
|
| 2583 | + $sql = 'UPDATE '.$databaseName.$this->quote_string($table)." SET ${SET} WHERE (${WHERE})"; |
|
| 2584 | 2584 | |
| 2585 | 2585 | return $this->query($sql); |
| 2586 | 2586 | } |