@@ -136,83 +136,83 @@ discard block |
||
| 136 | 136 | // Columns Statement |
| 137 | 137 | $columnStatements = []; |
| 138 | 138 | foreach ($columns as $columnName => $columnAttributes) { |
| 139 | - if (isset($columnAttributes[ 'type' ])) { |
|
| 140 | - if (isset($columnAttributes[ 'foreign_key' ])) { |
|
| 141 | - $foreignKeys[ $columnName ] = $columnAttributes[ 'foreign_key' ]; |
|
| 139 | + if (isset($columnAttributes['type'])) { |
|
| 140 | + if (isset($columnAttributes['foreign_key'])) { |
|
| 141 | + $foreignKeys[$columnName] = $columnAttributes['foreign_key']; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $columnStatementLine = []; |
| 145 | 145 | $columnName = $this->conn->escapeIdentifiers($columnName); |
| 146 | - $columnAttributes[ 'type' ] = strtoupper($columnAttributes[ 'type' ]); |
|
| 146 | + $columnAttributes['type'] = strtoupper($columnAttributes['type']); |
|
| 147 | 147 | |
| 148 | - if (isset($columnAttributes[ 'primary_key' ])) { |
|
| 149 | - if ($columnAttributes[ 'primary_key' ] === true) { |
|
| 148 | + if (isset($columnAttributes['primary_key'])) { |
|
| 149 | + if ($columnAttributes['primary_key'] === true) { |
|
| 150 | 150 | $primaryKeys[] = $columnName; |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if (isset($columnAttributes[ 'unique' ])) { |
|
| 155 | - if ($columnAttributes[ 'unique' ] === true) { |
|
| 154 | + if (isset($columnAttributes['unique'])) { |
|
| 155 | + if ($columnAttributes['unique'] === true) { |
|
| 156 | 156 | $uniqueKeys[] = $columnName; |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - if ($columnAttributes[ 'type' ] === 'ENUM') { |
|
| 161 | - if (empty($columnAttributes[ 'value' ])) { |
|
| 160 | + if ($columnAttributes['type'] === 'ENUM') { |
|
| 161 | + if (empty($columnAttributes['value'])) { |
|
| 162 | 162 | continue; |
| 163 | 163 | } else { |
| 164 | - if (is_string($columnAttributes[ 'value' ])) { |
|
| 165 | - $columnAttributes[ 'value' ] = explode(',', $columnAttributes[ 'value' ]); |
|
| 164 | + if (is_string($columnAttributes['value'])) { |
|
| 165 | + $columnAttributes['value'] = explode(',', $columnAttributes['value']); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $columnAttributes[ 'value' ] = array_map(function ($value) { |
|
| 168 | + $columnAttributes['value'] = array_map(function($value) { |
|
| 169 | 169 | return $this->conn->escape(str_replace('\'', '', trim($value))); |
| 170 | - }, $columnAttributes[ 'value' ]); |
|
| 170 | + }, $columnAttributes['value']); |
|
| 171 | 171 | |
| 172 | 172 | $columnStatementLine[] = $columnName . |
| 173 | - ' ' . $columnAttributes[ 'type' ] . '(' . |
|
| 174 | - implode(',', $columnAttributes[ 'value' ]) |
|
| 173 | + ' ' . $columnAttributes['type'] . '(' . |
|
| 174 | + implode(',', $columnAttributes['value']) |
|
| 175 | 175 | . ')'; |
| 176 | 176 | } |
| 177 | - } elseif (isset($columnAttributes[ 'length' ])) { |
|
| 178 | - $columnStatementLine[] = $columnName . ' ' . $columnAttributes[ 'type' ] . '(' . $columnAttributes[ 'length' ] . ')'; |
|
| 177 | + } elseif (isset($columnAttributes['length'])) { |
|
| 178 | + $columnStatementLine[] = $columnName . ' ' . $columnAttributes['type'] . '(' . $columnAttributes['length'] . ')'; |
|
| 179 | 179 | } else { |
| 180 | - $columnStatementLine[] = $columnName . ' ' . $columnAttributes[ 'type' ]; |
|
| 180 | + $columnStatementLine[] = $columnName . ' ' . $columnAttributes['type']; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if (isset($columnAttributes[ 'unsigned' ])) { |
|
| 184 | - if ($columnAttributes[ 'unsigned' ] === true) { |
|
| 185 | - if (in_array($columnAttributes[ 'type' ], $this->unsignedSupportColumnTypes)) { |
|
| 183 | + if (isset($columnAttributes['unsigned'])) { |
|
| 184 | + if ($columnAttributes['unsigned'] === true) { |
|
| 185 | + if (in_array($columnAttributes['type'], $this->unsignedSupportColumnTypes)) { |
|
| 186 | 186 | $columnStatementLine[] = 'UNSIGNED'; |
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if (isset($columnAttributes[ 'collate' ])) { |
|
| 192 | - $columnStatementLine[] = 'COLLATE ' . $columnAttributes[ 'collate' ]; |
|
| 193 | - } elseif (in_array($columnAttributes[ 'type' ], |
|
| 191 | + if (isset($columnAttributes['collate'])) { |
|
| 192 | + $columnStatementLine[] = 'COLLATE ' . $columnAttributes['collate']; |
|
| 193 | + } elseif (in_array($columnAttributes['type'], |
|
| 194 | 194 | ['CHAR', 'VARCHAR', 'TEXT', 'LONGTEXT', 'TINYTEXT', 'ENUM'])) { |
| 195 | 195 | $columnStatementLine[] = 'COLLATE ' . $this->conn->getConfig('collate'); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if (isset($columnAttributes[ 'not_null' ])) { |
|
| 199 | - if ($columnAttributes[ 'not_null' ] === true) { |
|
| 198 | + if (isset($columnAttributes['not_null'])) { |
|
| 199 | + if ($columnAttributes['not_null'] === true) { |
|
| 200 | 200 | $columnStatementLine[] = 'NOT NULL'; |
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if (isset($columnAttributes[ 'default' ])) { |
|
| 205 | - $columnStatementLine[] = 'DEFAULT ' . $this->conn->escape($columnAttributes[ 'default' ]); |
|
| 204 | + if (isset($columnAttributes['default'])) { |
|
| 205 | + $columnStatementLine[] = 'DEFAULT ' . $this->conn->escape($columnAttributes['default']); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - if (isset($columnAttributes[ 'auto_increment' ])) { |
|
| 209 | - if ($columnAttributes[ 'auto_increment' ] === true) { |
|
| 208 | + if (isset($columnAttributes['auto_increment'])) { |
|
| 209 | + if ($columnAttributes['auto_increment'] === true) { |
|
| 210 | 210 | $columnStatementLine[] = 'AUTO_INCREMENT '; |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - if (isset($columnAttributes[ 'comment' ])) { |
|
| 215 | - $columnStatementLine[] = 'COMMENT ' . $columnAttributes[ 'comment' ]; |
|
| 214 | + if (isset($columnAttributes['comment'])) { |
|
| 215 | + $columnStatementLine[] = 'COMMENT ' . $columnAttributes['comment']; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | $columnStatements[] = "\t" . implode(' ', $columnStatementLine); |
@@ -242,16 +242,16 @@ discard block |
||
| 242 | 242 | // Foreign Keys Statement |
| 243 | 243 | if (count($foreignKeys)) { |
| 244 | 244 | foreach ($foreignKeys as $foreignKeyColumnName => $foreignKeyAttributes) { |
| 245 | - if (empty($foreignKeyAttributes[ 'name' ])) { |
|
| 246 | - $foreignKeyAttributes[ 'name' ] = 'fk_' . $foreignKeyColumnName; |
|
| 245 | + if (empty($foreignKeyAttributes['name'])) { |
|
| 246 | + $foreignKeyAttributes['name'] = 'fk_' . $foreignKeyColumnName; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if (isset($foreignKeyAttributes[ 'references' ])) { |
|
| 249 | + if (isset($foreignKeyAttributes['references'])) { |
|
| 250 | 250 | $keyStatements[] = 'KEY ' . |
| 251 | - $this->conn->escapeIdentifiers($foreignKeyAttributes[ 'name' ]) . |
|
| 251 | + $this->conn->escapeIdentifiers($foreignKeyAttributes['name']) . |
|
| 252 | 252 | ' (' . $this->conn->escapeIdentifiers($foreignKeyColumnName) . ')'; |
| 253 | 253 | |
| 254 | - $referenceParts = array_map('trim', explode('.', $foreignKeyAttributes[ 'references' ])); |
|
| 254 | + $referenceParts = array_map('trim', explode('.', $foreignKeyAttributes['references'])); |
|
| 255 | 255 | list($referenceTable, $referenceColumn) = $referenceParts; |
| 256 | 256 | |
| 257 | 257 | $referenceOnDelete = 'NO ACTION'; |
@@ -264,20 +264,20 @@ discard block |
||
| 264 | 264 | 'SET NULL', |
| 265 | 265 | ]; |
| 266 | 266 | |
| 267 | - if (isset($foreignKeyAttributes[ 'on_delete' ])) { |
|
| 268 | - if (in_array($foreignKeyAttributes[ 'on_delete' ], $validReferenceActions)) { |
|
| 269 | - $referenceOnDelete = $foreignKeyAttributes[ 'on_delete' ]; |
|
| 267 | + if (isset($foreignKeyAttributes['on_delete'])) { |
|
| 268 | + if (in_array($foreignKeyAttributes['on_delete'], $validReferenceActions)) { |
|
| 269 | + $referenceOnDelete = $foreignKeyAttributes['on_delete']; |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - if (isset($foreignKeyAttributes[ 'on_update' ])) { |
|
| 274 | - if (in_array($foreignKeyAttributes[ 'on_update' ], $validReferenceActions)) { |
|
| 275 | - $referenceOnUpdate = $foreignKeyAttributes[ 'on_update' ]; |
|
| 273 | + if (isset($foreignKeyAttributes['on_update'])) { |
|
| 274 | + if (in_array($foreignKeyAttributes['on_update'], $validReferenceActions)) { |
|
| 275 | + $referenceOnUpdate = $foreignKeyAttributes['on_update']; |
|
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | $constraintStatements[] = 'CONSTRAINT ' . |
| 280 | - $this->conn->escapeIdentifiers($foreignKeyAttributes[ 'name' ]) . |
|
| 280 | + $this->conn->escapeIdentifiers($foreignKeyAttributes['name']) . |
|
| 281 | 281 | ' FOREIGN KEY (' . $this->conn->escapeIdentifiers($foreignKeyColumnName) . ') REFERENCES ' . |
| 282 | 282 | $this->conn->escapeIdentifiers($referenceTable) . ' (' . $this->conn->escapeIdentifiers($referenceColumn) . |
| 283 | 283 | ') ON DELETE ' . $referenceOnDelete . ' ON UPDATE ' . $referenceOnUpdate; |
@@ -289,25 +289,25 @@ discard block |
||
| 289 | 289 | array_merge($columnStatements, $keyStatements, $constraintStatements)); |
| 290 | 290 | |
| 291 | 291 | if (empty($attributes)) { |
| 292 | - $attributes[ 'engine' ] = 'InnoDB'; |
|
| 292 | + $attributes['engine'] = 'InnoDB'; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - if( ! array_key_exists('charset', $attributes) ) { |
|
| 296 | - $attributes[ 'charset' ] = $this->conn->getConfig('charset'); |
|
| 295 | + if ( ! array_key_exists('charset', $attributes)) { |
|
| 296 | + $attributes['charset'] = $this->conn->getConfig('charset'); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - if( ! array_key_exists('collate', $attributes) ) { |
|
| 300 | - $attributes[ 'collate' ] = $this->conn->getConfig('collate'); |
|
| 299 | + if ( ! array_key_exists('collate', $attributes)) { |
|
| 300 | + $attributes['collate'] = $this->conn->getConfig('collate'); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | $attributeStatements = []; |
| 304 | 304 | foreach ($attributes as $key => $value) { |
| 305 | - if(is_string($key)) { |
|
| 305 | + if (is_string($key)) { |
|
| 306 | 306 | $key = strtoupper(dash($key)); |
| 307 | 307 | |
| 308 | 308 | if ($key === 'CHARSET') { |
| 309 | - $attributeStatements[] = 'DEFAULT CHARACTER SET = ' . $value; |
|
| 310 | - } elseif(in_array($key, $this->quotedTableOptions)) { |
|
| 309 | + $attributeStatements[] = 'DEFAULT CHARACTER SET = ' . $value; |
|
| 310 | + } elseif (in_array($key, $this->quotedTableOptions)) { |
|
| 311 | 311 | $attributeStatements[] = $this->conn->escape($key) . ' = ' . $value; |
| 312 | 312 | } else { |
| 313 | 313 | $attributeStatements[] = $this->conn->escapeString($key) . ' = ' . $value; |
@@ -367,63 +367,63 @@ discard block |
||
| 367 | 367 | $alterTableStatementStrings[] = strtoupper($action); |
| 368 | 368 | $alterTableStatementStrings[] = $this->conn->escapeIdentifiers($column); |
| 369 | 369 | |
| 370 | - if (isset($attributes[ 'type' ])) { |
|
| 371 | - if ($attributes[ 'type' ] === 'ENUM') { |
|
| 372 | - if (empty($attributes[ 'value' ])) { |
|
| 370 | + if (isset($attributes['type'])) { |
|
| 371 | + if ($attributes['type'] === 'ENUM') { |
|
| 372 | + if (empty($attributes['value'])) { |
|
| 373 | 373 | return false; |
| 374 | 374 | } else { |
| 375 | - if (is_string($attributes[ 'value' ])) { |
|
| 376 | - $attributes[ 'value' ] = explode(',', $attributes[ 'value' ]); |
|
| 375 | + if (is_string($attributes['value'])) { |
|
| 376 | + $attributes['value'] = explode(',', $attributes['value']); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - $attributes[ 'value' ] = array_map(function ($value) { |
|
| 379 | + $attributes['value'] = array_map(function($value) { |
|
| 380 | 380 | return $this->conn->escape(str_replace('\'', '', trim($value))); |
| 381 | - }, $attributes[ 'value' ]); |
|
| 381 | + }, $attributes['value']); |
|
| 382 | 382 | |
| 383 | - $alterTableStatementStrings[] = $attributes[ 'type' ] . '(' . |
|
| 384 | - implode(',', $attributes[ 'value' ]) |
|
| 383 | + $alterTableStatementStrings[] = $attributes['type'] . '(' . |
|
| 384 | + implode(',', $attributes['value']) |
|
| 385 | 385 | . ')'; |
| 386 | 386 | } |
| 387 | - } elseif (isset($attributes[ 'length' ])) { |
|
| 388 | - $alterTableStatementStrings[] = $attributes[ 'type' ] . '(' . $attributes[ 'length' ] . ')'; |
|
| 387 | + } elseif (isset($attributes['length'])) { |
|
| 388 | + $alterTableStatementStrings[] = $attributes['type'] . '(' . $attributes['length'] . ')'; |
|
| 389 | 389 | } else { |
| 390 | - $alterTableStatementStrings[] = $attributes[ 'type' ]; |
|
| 390 | + $alterTableStatementStrings[] = $attributes['type']; |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - if (isset($attributes[ 'unsigned' ])) { |
|
| 394 | - if ($attributes[ 'unsigned' ] === true) { |
|
| 395 | - if (in_array($attributes[ 'type' ], |
|
| 393 | + if (isset($attributes['unsigned'])) { |
|
| 394 | + if ($attributes['unsigned'] === true) { |
|
| 395 | + if (in_array($attributes['type'], |
|
| 396 | 396 | ['INT', 'BIGINT', 'SMALLINT', 'TINYINT', 'FLOAT', 'DECIMAL', 'REAL'])) { |
| 397 | 397 | $alterTableStatementStrings[] = 'UNSIGNED'; |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - if (isset($attributes[ 'collate' ])) { |
|
| 403 | - $alterTableStatementStrings[] = 'COLLATE ' . $attributes[ 'collate' ]; |
|
| 404 | - } elseif (in_array($attributes[ 'type' ], |
|
| 402 | + if (isset($attributes['collate'])) { |
|
| 403 | + $alterTableStatementStrings[] = 'COLLATE ' . $attributes['collate']; |
|
| 404 | + } elseif (in_array($attributes['type'], |
|
| 405 | 405 | ['CHAR', 'VARCHAR', 'TEXT', 'LONGTEXT', 'TINYTEXT', 'ENUM'])) { |
| 406 | 406 | $alterTableStatementStrings[] = 'COLLATE ' . $this->conn->getConfig('collate'); |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - if (isset($attributes[ 'not_null' ])) { |
|
| 410 | - if ($attributes[ 'not_null' ] === true) { |
|
| 409 | + if (isset($attributes['not_null'])) { |
|
| 410 | + if ($attributes['not_null'] === true) { |
|
| 411 | 411 | $alterTableStatementStrings[] = 'NOT NULL'; |
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - if (isset($attributes[ 'default' ])) { |
|
| 416 | - $alterTableStatementStrings[] = 'DEFAULT ' . $this->conn->escape($attributes[ 'default' ]); |
|
| 415 | + if (isset($attributes['default'])) { |
|
| 416 | + $alterTableStatementStrings[] = 'DEFAULT ' . $this->conn->escape($attributes['default']); |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - if (isset($attributes[ 'auto_increment' ])) { |
|
| 420 | - if ($attributes[ 'auto_increment' ] === true) { |
|
| 419 | + if (isset($attributes['auto_increment'])) { |
|
| 420 | + if ($attributes['auto_increment'] === true) { |
|
| 421 | 421 | $alterTableStatementStrings[] = 'AUTO_INCREMENT '; |
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - if (isset($attributes[ 'comment' ])) { |
|
| 426 | - $alterTableStatementStrings[] = 'COMMENT ' . $attributes[ 'comment' ]; |
|
| 425 | + if (isset($attributes['comment'])) { |
|
| 426 | + $alterTableStatementStrings[] = 'COMMENT ' . $attributes['comment']; |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | $statementLines[] = implode(' ', $alterTableStatementStrings) . ';'; |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | { |
| 465 | 465 | $statementLines[] = 'ALTER TABLE ' . $this->conn->escapeIdentifiers($table); |
| 466 | 466 | |
| 467 | - $keys = array_map(function ($column) { |
|
| 467 | + $keys = array_map(function($column) { |
|
| 468 | 468 | return $this->conn->escapeIdentifiers($column); |
| 469 | 469 | }, $columns); |
| 470 | 470 | |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | { |
| 538 | 538 | $statementLines[] = 'ALTER TABLE ' . $this->conn->escapeIdentifiers($table); |
| 539 | 539 | |
| 540 | - $keys = array_map(function ($column) { |
|
| 540 | + $keys = array_map(function($column) { |
|
| 541 | 541 | return $this->conn->escapeIdentifiers($column); |
| 542 | 542 | }, $columns); |
| 543 | 543 | |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | */ |
| 566 | 566 | protected function platformCreateTableIndexesStatement($table, array $columns, $unique = false) |
| 567 | 567 | { |
| 568 | - $keys = array_map(function ($column) { |
|
| 568 | + $keys = array_map(function($column) { |
|
| 569 | 569 | return $this->conn->escapeIdentifiers($column); |
| 570 | 570 | }, $columns); |
| 571 | 571 | |
@@ -648,13 +648,13 @@ discard block |
||
| 648 | 648 | $columns = array_keys($conditions); |
| 649 | 649 | |
| 650 | 650 | if (count($conditions) == 1) { |
| 651 | - $statementLines[] = 'ADD CHECK (' . $this->conn->escapeIdentifiers($columns[ 0 ]) . ')'; |
|
| 651 | + $statementLines[] = 'ADD CHECK (' . $this->conn->escapeIdentifiers($columns[0]) . ')'; |
|
| 652 | 652 | } else { |
| 653 | 653 | $conditionStatementStrings = []; |
| 654 | 654 | |
| 655 | 655 | foreach ($conditions as $column => $condition) { |
| 656 | 656 | if (preg_match('/\s*(?:<|>|!)?=\s*|\s*<>?\s*|\s*>\s*/i', $column, $match, PREG_OFFSET_CAPTURE)) { |
| 657 | - $operator = trim($match[ 0 ]); |
|
| 657 | + $operator = trim($match[0]); |
|
| 658 | 658 | $column = trim(str_replace($operator, '', $column)); |
| 659 | 659 | |
| 660 | 660 | $conditionStatementStrings[] = $this->conn->escapeIdentifiers($column) . $operator . $this->conn->escape($condition); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function __construct(AbstractConnection &$conn) |
| 102 | 102 | {
|
| 103 | - $this->conn =& $conn; |
|
| 103 | + $this->conn = & $conn; |
|
| 104 | 104 | $this->builderCache = new Query\BuilderCache(); |
| 105 | 105 | $this->cacheMode = $this->conn->getConfig('cacheEnable');
|
| 106 | 106 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $alias = empty($alias) |
| 282 | 282 | ? strtolower($type) . '_' . $field |
| 283 | 283 | : $alias; |
| 284 | - $sqlStatement = sprintf($SqlAggregateFunctions[ $type ], $field) |
|
| 284 | + $sqlStatement = sprintf($SqlAggregateFunctions[$type], $field) |
|
| 285 | 285 | . ' AS ' |
| 286 | 286 | . $this->conn->escapeIdentifiers($alias); |
| 287 | 287 | |
@@ -336,11 +336,11 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | for ($i = 0; $i < $countFieldAlias; $i++) {
|
| 338 | 338 | if ($i == 0) {
|
| 339 | - $fieldAlias[ $i ] = $fieldAlias[ $i ] . "'+"; |
|
| 339 | + $fieldAlias[$i] = $fieldAlias[$i] . "'+"; |
|
| 340 | 340 | } elseif ($i == ($countFieldAlias - 1)) {
|
| 341 | - $fieldAlias[ $i ] = "'+" . $fieldAlias[ $i ]; |
|
| 341 | + $fieldAlias[$i] = "'+" . $fieldAlias[$i]; |
|
| 342 | 342 | } else {
|
| 343 | - $fieldAlias[ $i ] = "'+" . $fieldAlias[ $i ] . "'+"; |
|
| 343 | + $fieldAlias[$i] = "'+" . $fieldAlias[$i] . "'+"; |
|
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | |
| 493 | 493 | $this->select( |
| 494 | 494 | sprintf( |
| 495 | - $SqlScalarFunctions[ $type ], |
|
| 495 | + $SqlScalarFunctions[$type], |
|
| 496 | 496 | $field, |
| 497 | 497 | $this->conn->escapeIdentifiers($alias) |
| 498 | 498 | ) |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | |
| 698 | 698 | if (is_array($field)) {
|
| 699 | 699 | $fieldName = key($field); |
| 700 | - $fieldAlias = $field[ $fieldName ]; |
|
| 700 | + $fieldAlias = $field[$fieldName]; |
|
| 701 | 701 | } elseif (strpos($field, ' AS ') !== false) {
|
| 702 | 702 | $xField = explode(' AS ', $field);
|
| 703 | 703 | $xField = array_map('trim', $xField);
|
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | public function dateDiff(array $fields, $alias) |
| 905 | 905 | {
|
| 906 | 906 | $dateTimeStart = key($fields); |
| 907 | - $dateTimeEnd = $fields[ $dateTimeStart ]; |
|
| 907 | + $dateTimeEnd = $fields[$dateTimeStart]; |
|
| 908 | 908 | |
| 909 | 909 | if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $dateTimeStart)) {
|
| 910 | 910 | $dateTimeStart = $this->conn->escape($dateTimeStart); |
@@ -1098,14 +1098,14 @@ discard block |
||
| 1098 | 1098 | // Split multiple conditions |
| 1099 | 1099 | if (preg_match_all('/\sAND\s|\sOR\s/i', $condition, $joints, PREG_OFFSET_CAPTURE)) {
|
| 1100 | 1100 | $conditions = []; |
| 1101 | - $joints = $joints[ 0 ]; |
|
| 1101 | + $joints = $joints[0]; |
|
| 1102 | 1102 | array_unshift($joints, ['', 0]); |
| 1103 | 1103 | |
| 1104 | 1104 | for ($i = count($joints) - 1, $pos = strlen($condition); $i >= 0; $i--) {
|
| 1105 | - $joints[ $i ][ 1 ] += strlen($joints[ $i ][ 0 ]); // offset |
|
| 1106 | - $conditions[ $i ] = substr($condition, $joints[ $i ][ 1 ], $pos - $joints[ $i ][ 1 ]); |
|
| 1107 | - $pos = $joints[ $i ][ 1 ] - strlen($joints[ $i ][ 0 ]); |
|
| 1108 | - $joints[ $i ] = $joints[ $i ][ 0 ]; |
|
| 1105 | + $joints[$i][1] += strlen($joints[$i][0]); // offset |
|
| 1106 | + $conditions[$i] = substr($condition, $joints[$i][1], $pos - $joints[$i][1]); |
|
| 1107 | + $pos = $joints[$i][1] - strlen($joints[$i][0]); |
|
| 1108 | + $joints[$i] = $joints[$i][0]; |
|
| 1109 | 1109 | } |
| 1110 | 1110 | } else {
|
| 1111 | 1111 | $conditions = [$condition]; |
@@ -1114,17 +1114,17 @@ discard block |
||
| 1114 | 1114 | |
| 1115 | 1115 | $condition = ' ON '; |
| 1116 | 1116 | for ($i = 0, $c = count($conditions); $i < $c; $i++) {
|
| 1117 | - $operator = $this->getOperator($conditions[ $i ]); |
|
| 1118 | - $condition .= $joints[ $i ]; |
|
| 1117 | + $operator = $this->getOperator($conditions[$i]); |
|
| 1118 | + $condition .= $joints[$i]; |
|
| 1119 | 1119 | $condition .= preg_match( |
| 1120 | 1120 | "/(\(*)?([\[\]\w\.'-]+)" . preg_quote($operator) . "(.*)/i", |
| 1121 | - $conditions[ $i ], |
|
| 1121 | + $conditions[$i], |
|
| 1122 | 1122 | $match |
| 1123 | 1123 | ) |
| 1124 | - ? $match[ 1 ] . $this->conn->protectIdentifiers( |
|
| 1125 | - $match[ 2 ] |
|
| 1126 | - ) . $operator . $this->conn->protectIdentifiers($match[ 3 ]) |
|
| 1127 | - : $conditions[ $i ]; |
|
| 1124 | + ? $match[1] . $this->conn->protectIdentifiers( |
|
| 1125 | + $match[2] |
|
| 1126 | + ) . $operator . $this->conn->protectIdentifiers($match[3]) |
|
| 1127 | + : $conditions[$i]; |
|
| 1128 | 1128 | } |
| 1129 | 1129 | } |
| 1130 | 1130 | |
@@ -1188,23 +1188,23 @@ discard block |
||
| 1188 | 1188 | : ''; |
| 1189 | 1189 | |
| 1190 | 1190 | $operator = [ |
| 1191 | - '\s*(?:<|>|!)?=\s*', // =, <=, >=, != |
|
| 1192 | - '\s*<>?\s*', // <, <> |
|
| 1193 | - '\s*>\s*', // > |
|
| 1194 | - '\s+IS NULL', // IS NULL |
|
| 1195 | - '\s+IS NOT NULL', // IS NOT NULL |
|
| 1196 | - '\s+EXISTS\s*\(.*\)', // EXISTS(Sql) |
|
| 1197 | - '\s+NOT EXISTS\s*\(.*\)', // NOT EXISTS(Sql) |
|
| 1198 | - '\s+BETWEEN\s+', // BETWEEN value AND value |
|
| 1199 | - '\s+IN\s*\(.*\)', // IN(list) |
|
| 1200 | - '\s+NOT IN\s*\(.*\)', // NOT IN (list) |
|
| 1201 | - '\s+LIKE\s+\S.*(' . $likeEscapeString . ')?', // LIKE 'expr'[ ESCAPE '%s']
|
|
| 1191 | + '\s*(?:<|>|!)?=\s*', // =, <=, >=, != |
|
| 1192 | + '\s*<>?\s*', // <, <> |
|
| 1193 | + '\s*>\s*', // > |
|
| 1194 | + '\s+IS NULL', // IS NULL |
|
| 1195 | + '\s+IS NOT NULL', // IS NOT NULL |
|
| 1196 | + '\s+EXISTS\s*\(.*\)', // EXISTS(Sql) |
|
| 1197 | + '\s+NOT EXISTS\s*\(.*\)', // NOT EXISTS(Sql) |
|
| 1198 | + '\s+BETWEEN\s+', // BETWEEN value AND value |
|
| 1199 | + '\s+IN\s*\(.*\)', // IN(list) |
|
| 1200 | + '\s+NOT IN\s*\(.*\)', // NOT IN (list) |
|
| 1201 | + '\s+LIKE\s+\S.*(' . $likeEscapeString . ')?', // LIKE 'expr'[ ESCAPE '%s']
|
|
| 1202 | 1202 | '\s+NOT LIKE\s+\S.*(' . $likeEscapeString . ')?' // NOT LIKE 'expr'[ ESCAPE '%s']
|
| 1203 | 1203 | ]; |
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | return preg_match('/' . implode('|', $operator) . '/i', $string, $match)
|
| 1207 | - ? $match[ 0 ] |
|
| 1207 | + ? $match[0] |
|
| 1208 | 1208 | : false; |
| 1209 | 1209 | } |
| 1210 | 1210 | |
@@ -1274,8 +1274,8 @@ discard block |
||
| 1274 | 1274 | $fieldName = substr( |
| 1275 | 1275 | $fieldName, |
| 1276 | 1276 | 0, |
| 1277 | - $match[ 0 ][ 1 ] |
|
| 1278 | - ) . ($match[ 1 ][ 0 ] === '=' |
|
| 1277 | + $match[0][1] |
|
| 1278 | + ) . ($match[1][0] === '=' |
|
| 1279 | 1279 | ? ' IS NULL' |
| 1280 | 1280 | : ' IS NOT NULL'); |
| 1281 | 1281 | } elseif ($fieldValue instanceof AbstractQueryBuilder) {
|
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | public function bind($field, $value) |
| 1332 | 1332 | {
|
| 1333 | 1333 | if ( ! array_key_exists($field, $this->builderCache->binds)) {
|
| 1334 | - $this->builderCache->binds[ $field ] = $value; |
|
| 1334 | + $this->builderCache->binds[$field] = $value; |
|
| 1335 | 1335 | |
| 1336 | 1336 | return $field; |
| 1337 | 1337 | } |
@@ -1342,7 +1342,7 @@ discard block |
||
| 1342 | 1342 | ++$count; |
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | - $this->builderCache->binds[ $field . '_' . $count ] = $value; |
|
| 1345 | + $this->builderCache->binds[$field . '_' . $count] = $value; |
|
| 1346 | 1346 | |
| 1347 | 1347 | return $field . '_' . $count; |
| 1348 | 1348 | } |
@@ -1875,8 +1875,8 @@ discard block |
||
| 1875 | 1875 | |
| 1876 | 1876 | // Do we have a seed value? |
| 1877 | 1877 | $fields = ctype_digit((string)$fields) |
| 1878 | - ? sprintf($this->SqlOrderByRandomKeywords[ 1 ], $fields) |
|
| 1879 | - : $this->SqlOrderByRandomKeywords[ 0 ]; |
|
| 1878 | + ? sprintf($this->SqlOrderByRandomKeywords[1], $fields) |
|
| 1879 | + : $this->SqlOrderByRandomKeywords[0]; |
|
| 1880 | 1880 | } elseif (empty($fields)) {
|
| 1881 | 1881 | return $this; |
| 1882 | 1882 | } elseif ($direction !== '') {
|
@@ -1904,8 +1904,8 @@ discard block |
||
| 1904 | 1904 | PREG_OFFSET_CAPTURE |
| 1905 | 1905 | )) |
| 1906 | 1906 | ? [ |
| 1907 | - 'field' => ltrim(substr($fields, 0, $match[ 0 ][ 1 ])), |
|
| 1908 | - 'direction' => ' ' . $match[ 1 ][ 0 ], |
|
| 1907 | + 'field' => ltrim(substr($fields, 0, $match[0][1])), |
|
| 1908 | + 'direction' => ' ' . $match[1][0], |
|
| 1909 | 1909 | 'escape' => true, |
| 1910 | 1910 | ] |
| 1911 | 1911 | : ['field' => trim($fields), 'direction' => $direction, 'escape' => true]; |
@@ -2076,13 +2076,13 @@ discard block |
||
| 2076 | 2076 | } |
| 2077 | 2077 | |
| 2078 | 2078 | $numrows = 0; |
| 2079 | - if($result = $this->conn->query($sqlStatement, $this->builderCache->binds)) {
|
|
| 2080 | - if($result->count()) {
|
|
| 2079 | + if ($result = $this->conn->query($sqlStatement, $this->builderCache->binds)) {
|
|
| 2080 | + if ($result->count()) {
|
|
| 2081 | 2081 | $numrows = $result->first()->numrows; |
| 2082 | 2082 | } |
| 2083 | 2083 | } |
| 2084 | 2084 | |
| 2085 | - if($reset) {
|
|
| 2085 | + if ($reset) {
|
|
| 2086 | 2086 | $this->builderCache->reset(); |
| 2087 | 2087 | } |
| 2088 | 2088 | |
@@ -2196,13 +2196,13 @@ discard block |
||
| 2196 | 2196 | } |
| 2197 | 2197 | |
| 2198 | 2198 | $numrows = 0; |
| 2199 | - if($result = $this->conn->query($sqlStatement, $this->builderCache->binds)) {
|
|
| 2200 | - if($result->count()) {
|
|
| 2199 | + if ($result = $this->conn->query($sqlStatement, $this->builderCache->binds)) {
|
|
| 2200 | + if ($result->count()) {
|
|
| 2201 | 2201 | $numrows = $result->first()->numrows; |
| 2202 | 2202 | } |
| 2203 | 2203 | } |
| 2204 | 2204 | |
| 2205 | - if($reset) {
|
|
| 2205 | + if ($reset) {
|
|
| 2206 | 2206 | $this->builderCache->reset(); |
| 2207 | 2207 | } |
| 2208 | 2208 | |
@@ -2347,7 +2347,7 @@ discard block |
||
| 2347 | 2347 | if (count($this->builderCache->sets)) {
|
| 2348 | 2348 | $sqlStatement = $this->platformInsertStatement( |
| 2349 | 2349 | $this->conn->protectIdentifiers( |
| 2350 | - $this->builderCache->from[ 0 ], |
|
| 2350 | + $this->builderCache->from[0], |
|
| 2351 | 2351 | true, |
| 2352 | 2352 | $escape, |
| 2353 | 2353 | false |
@@ -2396,7 +2396,7 @@ discard block |
||
| 2396 | 2396 | foreach ($field as $key => $value) {
|
| 2397 | 2397 | if ($key === 'birthday' || $key === 'date') {
|
| 2398 | 2398 | if (is_array($value)) {
|
| 2399 | - $value = $value[ 'year' ] . '-' . $value[ 'month' ] . '-' . $value[ 'date' ]; |
|
| 2399 | + $value = $value['year'] . '-' . $value['month'] . '-' . $value['date']; |
|
| 2400 | 2400 | } elseif (is_object($value)) {
|
| 2401 | 2401 | $value = $value->year . '-' . $value->month . '-' . $value->date; |
| 2402 | 2402 | } |
@@ -2404,9 +2404,9 @@ discard block |
||
| 2404 | 2404 | $value = call_user_func_array($this->arrayObjectConversionMethod, [$value]); |
| 2405 | 2405 | } |
| 2406 | 2406 | |
| 2407 | - $this->builderCache->binds[ $key ] = $value; |
|
| 2408 | - $this->builderCache->sets[ $this->conn->protectIdentifiers($key, false, |
|
| 2409 | - $escape) ] = ':' . $key; |
|
| 2407 | + $this->builderCache->binds[$key] = $value; |
|
| 2408 | + $this->builderCache->sets[$this->conn->protectIdentifiers($key, false, |
|
| 2409 | + $escape)] = ':' . $key; |
|
| 2410 | 2410 | } |
| 2411 | 2411 | |
| 2412 | 2412 | return $this; |
@@ -2433,7 +2433,7 @@ discard block |
||
| 2433 | 2433 | foreach (get_object_vars($object) as $key => $value) {
|
| 2434 | 2434 | // There are some built in keys we need to ignore for this conversion |
| 2435 | 2435 | if ( ! is_object($value) && ! is_array($value) && $key !== '_parent_name') {
|
| 2436 | - $array[ $key ] = $value; |
|
| 2436 | + $array[$key] = $value; |
|
| 2437 | 2437 | } |
| 2438 | 2438 | } |
| 2439 | 2439 | |
@@ -2481,7 +2481,7 @@ discard block |
||
| 2481 | 2481 | $affectedRows = 0; |
| 2482 | 2482 | for ($i = 0, $total = count($sets); $i < $total; $i += $batchSize) {
|
| 2483 | 2483 | $Sql = $this->platformInsertBatchStatement( |
| 2484 | - $this->conn->protectIdentifiers($this->builderCache->from[ 0 ], true, $escape, false), |
|
| 2484 | + $this->conn->protectIdentifiers($this->builderCache->from[0], true, $escape, false), |
|
| 2485 | 2485 | $this->builderCache->keys, |
| 2486 | 2486 | array_slice($this->builderCache->sets, $i, $batchSize) |
| 2487 | 2487 | ); |
@@ -2582,8 +2582,8 @@ discard block |
||
| 2582 | 2582 | // There are some built in keys we need to ignore for this conversion |
| 2583 | 2583 | if ($field !== '_parent_name') {
|
| 2584 | 2584 | $i = 0; |
| 2585 | - foreach ($out[ $field ] as $data) {
|
|
| 2586 | - $array[ $i++ ][ $field ] = $data; |
|
| 2585 | + foreach ($out[$field] as $data) {
|
|
| 2586 | + $array[$i++][$field] = $data; |
|
| 2587 | 2587 | } |
| 2588 | 2588 | } |
| 2589 | 2589 | } |
@@ -2628,7 +2628,7 @@ discard block |
||
| 2628 | 2628 | if (count($this->builderCache->sets)) {
|
| 2629 | 2629 | $sqlStatement = $this->platformReplaceStatement( |
| 2630 | 2630 | $this->conn->protectIdentifiers( |
| 2631 | - $this->builderCache->from[ 0 ], |
|
| 2631 | + $this->builderCache->from[0], |
|
| 2632 | 2632 | true, |
| 2633 | 2633 | $escape, |
| 2634 | 2634 | false |
@@ -2691,7 +2691,7 @@ discard block |
||
| 2691 | 2691 | $affectedRows = 0; |
| 2692 | 2692 | for ($i = 0, $total = count($sets); $i < $total; $i += $batchSize) {
|
| 2693 | 2693 | $Sql = $this->platformReplaceStatement( |
| 2694 | - $this->conn->protectIdentifiers($this->builderCache->from[ 0 ], true, $escape, false), |
|
| 2694 | + $this->conn->protectIdentifiers($this->builderCache->from[0], true, $escape, false), |
|
| 2695 | 2695 | $this->builderCache->keys, |
| 2696 | 2696 | array_slice($this->builderCache->sets, $i, $batchSize) |
| 2697 | 2697 | ); |
@@ -2737,7 +2737,7 @@ discard block |
||
| 2737 | 2737 | if (count($this->builderCache->sets) && count($this->builderCache->from)) {
|
| 2738 | 2738 | $sqlStatement = $this->platformUpdateStatement( |
| 2739 | 2739 | $this->conn->protectIdentifiers( |
| 2740 | - $this->builderCache->from[ 0 ], |
|
| 2740 | + $this->builderCache->from[0], |
|
| 2741 | 2741 | true, |
| 2742 | 2742 | $escape, |
| 2743 | 2743 | false |
@@ -2798,7 +2798,7 @@ discard block |
||
| 2798 | 2798 | $affectedRows = 0; |
| 2799 | 2799 | for ($i = 0, $total = count($this->builderCache->sets); $i < $total; $i += $batchSize) {
|
| 2800 | 2800 | $sql = $this->platformUpdateBatchStatement( |
| 2801 | - $this->builderCache->from[ 0 ], |
|
| 2801 | + $this->builderCache->from[0], |
|
| 2802 | 2802 | array_slice($this->builderCache->sets, $i, $batchSize), |
| 2803 | 2803 | $this->conn->protectIdentifiers($index, false, $escape, false) |
| 2804 | 2804 | ); |
@@ -2810,7 +2810,7 @@ discard block |
||
| 2810 | 2810 | $affectedRows += $this->conn->getAffectedRows(); |
| 2811 | 2811 | } |
| 2812 | 2812 | |
| 2813 | - $this->builderCache[ 'where' ] = []; |
|
| 2813 | + $this->builderCache['where'] = []; |
|
| 2814 | 2814 | } |
| 2815 | 2815 | |
| 2816 | 2816 | if ( ! $this->testMode) {
|
@@ -2854,7 +2854,7 @@ discard block |
||
| 2854 | 2854 | |
| 2855 | 2855 | $bind = $this->bind($key, $value); |
| 2856 | 2856 | |
| 2857 | - $row[ $this->conn->protectIdentifiers($key, false, $escape) ] = ':' . $bind; |
|
| 2857 | + $row[$this->conn->protectIdentifiers($key, false, $escape)] = ':' . $bind; |
|
| 2858 | 2858 | } |
| 2859 | 2859 | |
| 2860 | 2860 | if ($indexSet === false) {
|
@@ -2905,7 +2905,7 @@ discard block |
||
| 2905 | 2905 | |
| 2906 | 2906 | $sqlStatement = $this->platformDeleteStatement( |
| 2907 | 2907 | $this->conn->protectIdentifiers( |
| 2908 | - $this->builderCache->from[ 0 ], |
|
| 2908 | + $this->builderCache->from[0], |
|
| 2909 | 2909 | true, |
| 2910 | 2910 | $this->conn->protectIdentifiers, |
| 2911 | 2911 | false |
@@ -3084,10 +3084,10 @@ discard block |
||
| 3084 | 3084 | // The reason we protect identifiers here rather than in the select() function |
| 3085 | 3085 | // is because until the user calls the from() function we don't know if there are aliases |
| 3086 | 3086 | foreach ($this->builderCache->select as $selectKey => $selectField) {
|
| 3087 | - $noEscape = isset($this->builderCache->noEscape [ $selectKey ]) |
|
| 3088 | - ? $this->builderCache->noEscape [ $selectKey ] |
|
| 3087 | + $noEscape = isset($this->builderCache->noEscape [$selectKey]) |
|
| 3088 | + ? $this->builderCache->noEscape [$selectKey] |
|
| 3089 | 3089 | : null; |
| 3090 | - $this->builderCache->select [ $selectKey ] = $this->conn->protectIdentifiers( |
|
| 3090 | + $this->builderCache->select [$selectKey] = $this->conn->protectIdentifiers( |
|
| 3091 | 3091 | $selectField, |
| 3092 | 3092 | false, |
| 3093 | 3093 | $noEscape |
@@ -3206,28 +3206,28 @@ discard block |
||
| 3206 | 3206 | if (count($this->builderCache->{$cacheKey}) > 0) {
|
| 3207 | 3207 | for ($i = 0, $c = count($this->builderCache->{$cacheKey}); $i < $c; $i++) {
|
| 3208 | 3208 | // Is this condition already compiled? |
| 3209 | - if (is_string($this->builderCache->{$cacheKey}[ $i ])) {
|
|
| 3209 | + if (is_string($this->builderCache->{$cacheKey}[$i])) {
|
|
| 3210 | 3210 | continue; |
| 3211 | - } elseif ($this->builderCache->{$cacheKey}[ $i ][ 'escape' ] === false) {
|
|
| 3212 | - $this->builderCache->{$cacheKey}[ $i ]
|
|
| 3213 | - = $this->builderCache->{$cacheKey}[ $i ][ 'condition' ];
|
|
| 3211 | + } elseif ($this->builderCache->{$cacheKey}[$i]['escape'] === false) {
|
|
| 3212 | + $this->builderCache->{$cacheKey}[$i]
|
|
| 3213 | + = $this->builderCache->{$cacheKey}[$i]['condition'];
|
|
| 3214 | 3214 | continue; |
| 3215 | 3215 | } |
| 3216 | 3216 | |
| 3217 | 3217 | // Split multiple conditions |
| 3218 | 3218 | $conditions = preg_split( |
| 3219 | 3219 | '/((?:^|\s+)AND\s+|(?:^|\s+)OR\s+)/i', |
| 3220 | - $this->builderCache->{$cacheKey}[ $i ][ 'condition' ],
|
|
| 3220 | + $this->builderCache->{$cacheKey}[$i]['condition'],
|
|
| 3221 | 3221 | -1, |
| 3222 | 3222 | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
| 3223 | 3223 | ); |
| 3224 | 3224 | |
| 3225 | 3225 | for ($ci = 0, $cc = count($conditions); $ci < $cc; $ci++) {
|
| 3226 | - if (($op = $this->getOperator($conditions[ $ci ])) === false |
|
| 3226 | + if (($op = $this->getOperator($conditions[$ci])) === false |
|
| 3227 | 3227 | OR |
| 3228 | 3228 | ! preg_match( |
| 3229 | 3229 | '/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(?<!\)))?(\)?)$/i',
|
| 3230 | - $conditions[ $ci ], |
|
| 3230 | + $conditions[$ci], |
|
| 3231 | 3231 | $matches |
| 3232 | 3232 | ) |
| 3233 | 3233 | ) {
|
@@ -3243,16 +3243,16 @@ discard block |
||
| 3243 | 3243 | // 5 => ')' /* optional */ |
| 3244 | 3244 | // ); |
| 3245 | 3245 | |
| 3246 | - if ( ! empty($matches[ 4 ])) {
|
|
| 3246 | + if ( ! empty($matches[4])) {
|
|
| 3247 | 3247 | //$this->isLiteral($matches[4]) OR $matches[4] = $this->protectIdentifiers(trim($matches[4])); |
| 3248 | - $matches[ 4 ] = ' ' . $matches[ 4 ]; |
|
| 3248 | + $matches[4] = ' ' . $matches[4]; |
|
| 3249 | 3249 | } |
| 3250 | 3250 | |
| 3251 | - $conditions[ $ci ] = $matches[ 1 ] . $this->conn->protectIdentifiers(trim($matches[ 2 ])) |
|
| 3252 | - . ' ' . trim($matches[ 3 ]) . $matches[ 4 ] . $matches[ 5 ]; |
|
| 3251 | + $conditions[$ci] = $matches[1] . $this->conn->protectIdentifiers(trim($matches[2])) |
|
| 3252 | + . ' ' . trim($matches[3]) . $matches[4] . $matches[5]; |
|
| 3253 | 3253 | } |
| 3254 | 3254 | |
| 3255 | - $this->builderCache->{$cacheKey}[ $i ] = implode('', $conditions);
|
|
| 3255 | + $this->builderCache->{$cacheKey}[$i] = implode('', $conditions);
|
|
| 3256 | 3256 | } |
| 3257 | 3257 | |
| 3258 | 3258 | if ($cacheKey === 'having') {
|
@@ -3291,17 +3291,17 @@ discard block |
||
| 3291 | 3291 | if (count($this->builderCache->groupBy) > 0) {
|
| 3292 | 3292 | for ($i = 0, $c = count($this->builderCache->groupBy); $i < $c; $i++) {
|
| 3293 | 3293 | // Is it already compiled? |
| 3294 | - if (is_string($this->builderCache->groupBy[ $i ])) {
|
|
| 3294 | + if (is_string($this->builderCache->groupBy[$i])) {
|
|
| 3295 | 3295 | continue; |
| 3296 | 3296 | } |
| 3297 | 3297 | |
| 3298 | - $this->builderCache->groupBy[ $i ] = ($this->builderCache->groupBy[ $i ][ 'escape' ] |
|
| 3298 | + $this->builderCache->groupBy[$i] = ($this->builderCache->groupBy[$i]['escape'] |
|
| 3299 | 3299 | === false OR |
| 3300 | 3300 | $this->isLiteral( |
| 3301 | - $this->builderCache->groupBy[ $i ][ 'field' ] |
|
| 3301 | + $this->builderCache->groupBy[$i]['field'] |
|
| 3302 | 3302 | )) |
| 3303 | - ? $this->builderCache->groupBy[ $i ][ 'field' ] |
|
| 3304 | - : $this->conn->protectIdentifiers($this->builderCache->groupBy[ $i ][ 'field' ]); |
|
| 3303 | + ? $this->builderCache->groupBy[$i]['field'] |
|
| 3304 | + : $this->conn->protectIdentifiers($this->builderCache->groupBy[$i]['field']); |
|
| 3305 | 3305 | } |
| 3306 | 3306 | |
| 3307 | 3307 | return "\n" . sprintf( |
@@ -3346,7 +3346,7 @@ discard block |
||
| 3346 | 3346 | : ["'"]; |
| 3347 | 3347 | } |
| 3348 | 3348 | |
| 3349 | - return in_array($string[ 0 ], $stringArray, true); |
|
| 3349 | + return in_array($string[0], $stringArray, true); |
|
| 3350 | 3350 | } |
| 3351 | 3351 | |
| 3352 | 3352 | //-------------------------------------------------------------------- |
@@ -3404,18 +3404,18 @@ discard block |
||
| 3404 | 3404 | {
|
| 3405 | 3405 | if (is_array($this->builderCache->orderBy) && count($this->builderCache->orderBy) > 0) {
|
| 3406 | 3406 | for ($i = 0, $c = count($this->builderCache->orderBy); $i < $c; $i++) {
|
| 3407 | - if ($this->builderCache->orderBy[ $i ][ 'escape' ] !== false |
|
| 3407 | + if ($this->builderCache->orderBy[$i]['escape'] !== false |
|
| 3408 | 3408 | && ! $this->isLiteral( |
| 3409 | - $this->builderCache->orderBy[ $i ][ 'field' ] |
|
| 3409 | + $this->builderCache->orderBy[$i]['field'] |
|
| 3410 | 3410 | ) |
| 3411 | 3411 | ) {
|
| 3412 | - $this->builderCache->orderBy[ $i ][ 'field' ] = $this->conn->protectIdentifiers( |
|
| 3413 | - $this->builderCache->orderBy[ $i ][ 'field' ] |
|
| 3412 | + $this->builderCache->orderBy[$i]['field'] = $this->conn->protectIdentifiers( |
|
| 3413 | + $this->builderCache->orderBy[$i]['field'] |
|
| 3414 | 3414 | ); |
| 3415 | 3415 | } |
| 3416 | 3416 | |
| 3417 | - $this->builderCache->orderBy[ $i ] = $this->builderCache->orderBy[ $i ][ 'field' ] |
|
| 3418 | - . $this->builderCache->orderBy[ $i ][ 'direction' ]; |
|
| 3417 | + $this->builderCache->orderBy[$i] = $this->builderCache->orderBy[$i]['field'] |
|
| 3418 | + . $this->builderCache->orderBy[$i]['direction']; |
|
| 3419 | 3419 | } |
| 3420 | 3420 | |
| 3421 | 3421 | return $this->builderCache->orderBy = "\n" . sprintf( |