@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function __construct(AbstractConnection &$conn) |
| 103 | 103 | {
|
| 104 | - $this->conn =& $conn; |
|
| 104 | + $this->conn = & $conn; |
|
| 105 | 105 | $this->builderCache = new QueryBuilderCache(); |
| 106 | 106 | $this->cacheMode = $this->conn->getConfig('cacheEnable');
|
| 107 | 107 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $alias = empty($alias) |
| 283 | 283 | ? strtolower($type) . '_' . $field |
| 284 | 284 | : $alias; |
| 285 | - $sqlStatement = sprintf($SqlAggregateFunctions[ $type ], $field) |
|
| 285 | + $sqlStatement = sprintf($SqlAggregateFunctions[$type], $field) |
|
| 286 | 286 | . ' AS ' |
| 287 | 287 | . $this->conn->escapeIdentifiers($alias); |
| 288 | 288 | |
@@ -337,11 +337,11 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | for ($i = 0; $i < $countFieldAlias; $i++) {
|
| 339 | 339 | if ($i == 0) {
|
| 340 | - $fieldAlias[ $i ] = $fieldAlias[ $i ] . "'+"; |
|
| 340 | + $fieldAlias[$i] = $fieldAlias[$i] . "'+"; |
|
| 341 | 341 | } elseif ($i == ($countFieldAlias - 1)) {
|
| 342 | - $fieldAlias[ $i ] = "'+" . $fieldAlias[ $i ]; |
|
| 342 | + $fieldAlias[$i] = "'+" . $fieldAlias[$i]; |
|
| 343 | 343 | } else {
|
| 344 | - $fieldAlias[ $i ] = "'+" . $fieldAlias[ $i ] . "'+"; |
|
| 344 | + $fieldAlias[$i] = "'+" . $fieldAlias[$i] . "'+"; |
|
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | $this->select( |
| 495 | 495 | sprintf( |
| 496 | - $SqlScalarFunctions[ $type ], |
|
| 496 | + $SqlScalarFunctions[$type], |
|
| 497 | 497 | $field, |
| 498 | 498 | $this->conn->escapeIdentifiers($alias) |
| 499 | 499 | ) |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | |
| 699 | 699 | if (is_array($field)) {
|
| 700 | 700 | $fieldName = key($field); |
| 701 | - $fieldAlias = $field[ $fieldName ]; |
|
| 701 | + $fieldAlias = $field[$fieldName]; |
|
| 702 | 702 | } elseif (strpos($field, ' AS ') !== false) {
|
| 703 | 703 | $xField = explode(' AS ', $field);
|
| 704 | 704 | $xField = array_map('trim', $xField);
|
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | public function dateDiff(array $fields, $alias) |
| 906 | 906 | {
|
| 907 | 907 | $dateTimeStart = key($fields); |
| 908 | - $dateTimeEnd = $fields[ $dateTimeStart ]; |
|
| 908 | + $dateTimeEnd = $fields[$dateTimeStart]; |
|
| 909 | 909 | |
| 910 | 910 | if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $dateTimeStart)) {
|
| 911 | 911 | $dateTimeStart = $this->conn->escape($dateTimeStart); |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | |
| 980 | 980 | $this->builderCache->from[] = $this->conn->protectIdentifiers($name, true, null, false); |
| 981 | 981 | } |
| 982 | - } elseif(is_array($table)) {
|
|
| 982 | + } elseif (is_array($table)) {
|
|
| 983 | 983 | foreach ($table as $alias => $name) {
|
| 984 | 984 | $name = trim($name) . ' AS ' . trim($alias); |
| 985 | 985 | |
@@ -1099,14 +1099,14 @@ discard block |
||
| 1099 | 1099 | // Split multiple conditions |
| 1100 | 1100 | if (preg_match_all('/\sAND\s|\sOR\s/i', $condition, $joints, PREG_OFFSET_CAPTURE)) {
|
| 1101 | 1101 | $conditions = []; |
| 1102 | - $joints = $joints[ 0 ]; |
|
| 1102 | + $joints = $joints[0]; |
|
| 1103 | 1103 | array_unshift($joints, ['', 0]); |
| 1104 | 1104 | |
| 1105 | 1105 | for ($i = count($joints) - 1, $pos = strlen($condition); $i >= 0; $i--) {
|
| 1106 | - $joints[ $i ][ 1 ] += strlen($joints[ $i ][ 0 ]); // offset |
|
| 1107 | - $conditions[ $i ] = substr($condition, $joints[ $i ][ 1 ], $pos - $joints[ $i ][ 1 ]); |
|
| 1108 | - $pos = $joints[ $i ][ 1 ] - strlen($joints[ $i ][ 0 ]); |
|
| 1109 | - $joints[ $i ] = $joints[ $i ][ 0 ]; |
|
| 1106 | + $joints[$i][1] += strlen($joints[$i][0]); // offset |
|
| 1107 | + $conditions[$i] = substr($condition, $joints[$i][1], $pos - $joints[$i][1]); |
|
| 1108 | + $pos = $joints[$i][1] - strlen($joints[$i][0]); |
|
| 1109 | + $joints[$i] = $joints[$i][0]; |
|
| 1110 | 1110 | } |
| 1111 | 1111 | } else {
|
| 1112 | 1112 | $conditions = [$condition]; |
@@ -1115,17 +1115,17 @@ discard block |
||
| 1115 | 1115 | |
| 1116 | 1116 | $condition = ' ON '; |
| 1117 | 1117 | for ($i = 0, $c = count($conditions); $i < $c; $i++) {
|
| 1118 | - $operator = $this->getOperator($conditions[ $i ]); |
|
| 1119 | - $condition .= $joints[ $i ]; |
|
| 1118 | + $operator = $this->getOperator($conditions[$i]); |
|
| 1119 | + $condition .= $joints[$i]; |
|
| 1120 | 1120 | $condition .= preg_match( |
| 1121 | 1121 | "/(\(*)?([\[\]\w\.'-]+)" . preg_quote($operator) . "(.*)/i", |
| 1122 | - $conditions[ $i ], |
|
| 1122 | + $conditions[$i], |
|
| 1123 | 1123 | $match |
| 1124 | 1124 | ) |
| 1125 | - ? $match[ 1 ] . $this->conn->protectIdentifiers( |
|
| 1126 | - $match[ 2 ] |
|
| 1127 | - ) . $operator . $this->conn->protectIdentifiers($match[ 3 ]) |
|
| 1128 | - : $conditions[ $i ]; |
|
| 1125 | + ? $match[1] . $this->conn->protectIdentifiers( |
|
| 1126 | + $match[2] |
|
| 1127 | + ) . $operator . $this->conn->protectIdentifiers($match[3]) |
|
| 1128 | + : $conditions[$i]; |
|
| 1129 | 1129 | } |
| 1130 | 1130 | } |
| 1131 | 1131 | |
@@ -1189,23 +1189,23 @@ discard block |
||
| 1189 | 1189 | : ''; |
| 1190 | 1190 | |
| 1191 | 1191 | $operator = [ |
| 1192 | - '\s*(?:<|>|!)?=\s*', // =, <=, >=, != |
|
| 1193 | - '\s*<>?\s*', // <, <> |
|
| 1194 | - '\s*>\s*', // > |
|
| 1195 | - '\s+IS NULL', // IS NULL |
|
| 1196 | - '\s+IS NOT NULL', // IS NOT NULL |
|
| 1197 | - '\s+EXISTS\s*\(.*\)', // EXISTS(Sql) |
|
| 1198 | - '\s+NOT EXISTS\s*\(.*\)', // NOT EXISTS(Sql) |
|
| 1199 | - '\s+BETWEEN\s+', // BETWEEN value AND value |
|
| 1200 | - '\s+IN\s*\(.*\)', // IN(list) |
|
| 1201 | - '\s+NOT IN\s*\(.*\)', // NOT IN (list) |
|
| 1202 | - '\s+LIKE\s+\S.*(' . $likeEscapeString . ')?', // LIKE 'expr'[ ESCAPE '%s']
|
|
| 1192 | + '\s*(?:<|>|!)?=\s*', // =, <=, >=, != |
|
| 1193 | + '\s*<>?\s*', // <, <> |
|
| 1194 | + '\s*>\s*', // > |
|
| 1195 | + '\s+IS NULL', // IS NULL |
|
| 1196 | + '\s+IS NOT NULL', // IS NOT NULL |
|
| 1197 | + '\s+EXISTS\s*\(.*\)', // EXISTS(Sql) |
|
| 1198 | + '\s+NOT EXISTS\s*\(.*\)', // NOT EXISTS(Sql) |
|
| 1199 | + '\s+BETWEEN\s+', // BETWEEN value AND value |
|
| 1200 | + '\s+IN\s*\(.*\)', // IN(list) |
|
| 1201 | + '\s+NOT IN\s*\(.*\)', // NOT IN (list) |
|
| 1202 | + '\s+LIKE\s+\S.*(' . $likeEscapeString . ')?', // LIKE 'expr'[ ESCAPE '%s']
|
|
| 1203 | 1203 | '\s+NOT LIKE\s+\S.*(' . $likeEscapeString . ')?' // NOT LIKE 'expr'[ ESCAPE '%s']
|
| 1204 | 1204 | ]; |
| 1205 | 1205 | } |
| 1206 | 1206 | |
| 1207 | 1207 | return preg_match('/' . implode('|', $operator) . '/i', $string, $match)
|
| 1208 | - ? $match[ 0 ] |
|
| 1208 | + ? $match[0] |
|
| 1209 | 1209 | : false; |
| 1210 | 1210 | } |
| 1211 | 1211 | |
@@ -1275,8 +1275,8 @@ discard block |
||
| 1275 | 1275 | $fieldName = substr( |
| 1276 | 1276 | $fieldName, |
| 1277 | 1277 | 0, |
| 1278 | - $match[ 0 ][ 1 ] |
|
| 1279 | - ) . ($match[ 1 ][ 0 ] === '=' |
|
| 1278 | + $match[0][1] |
|
| 1279 | + ) . ($match[1][0] === '=' |
|
| 1280 | 1280 | ? ' IS NULL' |
| 1281 | 1281 | : ' IS NOT NULL'); |
| 1282 | 1282 | } elseif ($fieldValue instanceof AbstractQueryBuilder) {
|
@@ -1332,7 +1332,7 @@ discard block |
||
| 1332 | 1332 | public function bind($field, $value) |
| 1333 | 1333 | {
|
| 1334 | 1334 | if ( ! array_key_exists($field, $this->builderCache->binds)) {
|
| 1335 | - $this->builderCache->binds[ $field ] = $value; |
|
| 1335 | + $this->builderCache->binds[$field] = $value; |
|
| 1336 | 1336 | |
| 1337 | 1337 | return $field; |
| 1338 | 1338 | } |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | ++$count; |
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | - $this->builderCache->binds[ $field . '_' . $count ] = $value; |
|
| 1346 | + $this->builderCache->binds[$field . '_' . $count] = $value; |
|
| 1347 | 1347 | |
| 1348 | 1348 | return $field . '_' . $count; |
| 1349 | 1349 | } |
@@ -1876,8 +1876,8 @@ discard block |
||
| 1876 | 1876 | |
| 1877 | 1877 | // Do we have a seed value? |
| 1878 | 1878 | $fields = ctype_digit((string)$fields) |
| 1879 | - ? sprintf($this->SqlOrderByRandomKeywords[ 1 ], $fields) |
|
| 1880 | - : $this->SqlOrderByRandomKeywords[ 0 ]; |
|
| 1879 | + ? sprintf($this->SqlOrderByRandomKeywords[1], $fields) |
|
| 1880 | + : $this->SqlOrderByRandomKeywords[0]; |
|
| 1881 | 1881 | } elseif (empty($fields)) {
|
| 1882 | 1882 | return $this; |
| 1883 | 1883 | } elseif ($direction !== '') {
|
@@ -1905,8 +1905,8 @@ discard block |
||
| 1905 | 1905 | PREG_OFFSET_CAPTURE |
| 1906 | 1906 | )) |
| 1907 | 1907 | ? [ |
| 1908 | - 'field' => ltrim(substr($fields, 0, $match[ 0 ][ 1 ])), |
|
| 1909 | - 'direction' => ' ' . $match[ 1 ][ 0 ], |
|
| 1908 | + 'field' => ltrim(substr($fields, 0, $match[0][1])), |
|
| 1909 | + 'direction' => ' ' . $match[1][0], |
|
| 1910 | 1910 | 'escape' => true, |
| 1911 | 1911 | ] |
| 1912 | 1912 | : ['field' => trim($fields), 'direction' => $direction, 'escape' => true]; |
@@ -2325,7 +2325,7 @@ discard block |
||
| 2325 | 2325 | if (count($this->builderCache->sets)) {
|
| 2326 | 2326 | $sqlStatement = $this->platformInsertStatement( |
| 2327 | 2327 | $this->conn->protectIdentifiers( |
| 2328 | - $this->builderCache->from[ 0 ], |
|
| 2328 | + $this->builderCache->from[0], |
|
| 2329 | 2329 | true, |
| 2330 | 2330 | $escape, |
| 2331 | 2331 | false |
@@ -2374,7 +2374,7 @@ discard block |
||
| 2374 | 2374 | foreach ($field as $key => $value) {
|
| 2375 | 2375 | if ($key === 'birthday' || $key === 'date') {
|
| 2376 | 2376 | if (is_array($value)) {
|
| 2377 | - $value = $value[ 'year' ] . '-' . $value[ 'month' ] . '-' . $value[ 'date' ]; |
|
| 2377 | + $value = $value['year'] . '-' . $value['month'] . '-' . $value['date']; |
|
| 2378 | 2378 | } elseif (is_object($value)) {
|
| 2379 | 2379 | $value = $value->year . '-' . $value->month . '-' . $value->date; |
| 2380 | 2380 | } |
@@ -2382,9 +2382,9 @@ discard block |
||
| 2382 | 2382 | $value = call_user_func_array($this->arrayObjectConversionMethod, [$value]); |
| 2383 | 2383 | } |
| 2384 | 2384 | |
| 2385 | - $this->builderCache->binds[ $key ] = $value; |
|
| 2386 | - $this->builderCache->sets[ $this->conn->protectIdentifiers($key, false, |
|
| 2387 | - $escape) ] = ':' . $key; |
|
| 2385 | + $this->builderCache->binds[$key] = $value; |
|
| 2386 | + $this->builderCache->sets[$this->conn->protectIdentifiers($key, false, |
|
| 2387 | + $escape)] = ':' . $key; |
|
| 2388 | 2388 | } |
| 2389 | 2389 | |
| 2390 | 2390 | return $this; |
@@ -2411,7 +2411,7 @@ discard block |
||
| 2411 | 2411 | foreach (get_object_vars($object) as $key => $value) {
|
| 2412 | 2412 | // There are some built in keys we need to ignore for this conversion |
| 2413 | 2413 | if ( ! is_object($value) && ! is_array($value) && $key !== '_parent_name') {
|
| 2414 | - $array[ $key ] = $value; |
|
| 2414 | + $array[$key] = $value; |
|
| 2415 | 2415 | } |
| 2416 | 2416 | } |
| 2417 | 2417 | |
@@ -2459,7 +2459,7 @@ discard block |
||
| 2459 | 2459 | $affectedRows = 0; |
| 2460 | 2460 | for ($i = 0, $total = count($sets); $i < $total; $i += $batchSize) {
|
| 2461 | 2461 | $Sql = $this->platformInsertBatchStatement( |
| 2462 | - $this->conn->protectIdentifiers($this->builderCache->from[ 0 ], true, $escape, false), |
|
| 2462 | + $this->conn->protectIdentifiers($this->builderCache->from[0], true, $escape, false), |
|
| 2463 | 2463 | $this->builderCache->keys, |
| 2464 | 2464 | array_slice($this->builderCache->sets, $i, $batchSize) |
| 2465 | 2465 | ); |
@@ -2560,8 +2560,8 @@ discard block |
||
| 2560 | 2560 | // There are some built in keys we need to ignore for this conversion |
| 2561 | 2561 | if ($field !== '_parent_name') {
|
| 2562 | 2562 | $i = 0; |
| 2563 | - foreach ($out[ $field ] as $data) {
|
|
| 2564 | - $array[ $i++ ][ $field ] = $data; |
|
| 2563 | + foreach ($out[$field] as $data) {
|
|
| 2564 | + $array[$i++][$field] = $data; |
|
| 2565 | 2565 | } |
| 2566 | 2566 | } |
| 2567 | 2567 | } |
@@ -2612,7 +2612,7 @@ discard block |
||
| 2612 | 2612 | if (count($this->builderCache->sets)) {
|
| 2613 | 2613 | $sqlStatement = $this->platformReplaceStatement( |
| 2614 | 2614 | $this->conn->protectIdentifiers( |
| 2615 | - $this->builderCache->from[ 0 ], |
|
| 2615 | + $this->builderCache->from[0], |
|
| 2616 | 2616 | true, |
| 2617 | 2617 | $escape, |
| 2618 | 2618 | false |
@@ -2675,7 +2675,7 @@ discard block |
||
| 2675 | 2675 | $affectedRows = 0; |
| 2676 | 2676 | for ($i = 0, $total = count($sets); $i < $total; $i += $batchSize) {
|
| 2677 | 2677 | $Sql = $this->platformReplaceStatement( |
| 2678 | - $this->conn->protectIdentifiers($this->builderCache->from[ 0 ], true, $escape, false), |
|
| 2678 | + $this->conn->protectIdentifiers($this->builderCache->from[0], true, $escape, false), |
|
| 2679 | 2679 | $this->builderCache->keys, |
| 2680 | 2680 | array_slice($this->builderCache->sets, $i, $batchSize) |
| 2681 | 2681 | ); |
@@ -2727,7 +2727,7 @@ discard block |
||
| 2727 | 2727 | if (count($this->builderCache->sets) && count($this->builderCache->from)) {
|
| 2728 | 2728 | $sqlStatement = $this->platformUpdateStatement( |
| 2729 | 2729 | $this->conn->protectIdentifiers( |
| 2730 | - $this->builderCache->from[ 0 ], |
|
| 2730 | + $this->builderCache->from[0], |
|
| 2731 | 2731 | true, |
| 2732 | 2732 | $escape, |
| 2733 | 2733 | false |
@@ -2788,7 +2788,7 @@ discard block |
||
| 2788 | 2788 | $affectedRows = 0; |
| 2789 | 2789 | for ($i = 0, $total = count($this->builderCache->sets); $i < $total; $i += $batchSize) {
|
| 2790 | 2790 | $sql = $this->platformUpdateBatchStatement( |
| 2791 | - $this->builderCache->from[ 0 ], |
|
| 2791 | + $this->builderCache->from[0], |
|
| 2792 | 2792 | array_slice($this->builderCache->sets, $i, $batchSize), |
| 2793 | 2793 | $this->conn->protectIdentifiers($index, false, $escape, false) |
| 2794 | 2794 | ); |
@@ -2800,7 +2800,7 @@ discard block |
||
| 2800 | 2800 | $affectedRows += $this->conn->getAffectedRows(); |
| 2801 | 2801 | } |
| 2802 | 2802 | |
| 2803 | - $this->builderCache[ 'where' ] = []; |
|
| 2803 | + $this->builderCache['where'] = []; |
|
| 2804 | 2804 | } |
| 2805 | 2805 | |
| 2806 | 2806 | if ( ! $this->testMode) {
|
@@ -2844,7 +2844,7 @@ discard block |
||
| 2844 | 2844 | |
| 2845 | 2845 | $bind = $this->bind($key, $value); |
| 2846 | 2846 | |
| 2847 | - $row[ $this->conn->protectIdentifiers($key, false, $escape) ] = ':' . $bind; |
|
| 2847 | + $row[$this->conn->protectIdentifiers($key, false, $escape)] = ':' . $bind; |
|
| 2848 | 2848 | } |
| 2849 | 2849 | |
| 2850 | 2850 | if ($indexSet === false) {
|
@@ -2895,7 +2895,7 @@ discard block |
||
| 2895 | 2895 | |
| 2896 | 2896 | $sqlStatement = $this->platformDeleteStatement( |
| 2897 | 2897 | $this->conn->protectIdentifiers( |
| 2898 | - $this->builderCache->from[ 0 ], |
|
| 2898 | + $this->builderCache->from[0], |
|
| 2899 | 2899 | true, |
| 2900 | 2900 | $this->conn->isProtectIdentifiers, |
| 2901 | 2901 | false |
@@ -3074,10 +3074,10 @@ discard block |
||
| 3074 | 3074 | // The reason we protect identifiers here rather than in the select() function |
| 3075 | 3075 | // is because until the user calls the from() function we don't know if there are aliases |
| 3076 | 3076 | foreach ($this->builderCache->select as $selectKey => $selectField) {
|
| 3077 | - $noEscape = isset($this->builderCache->noEscape [ $selectKey ]) |
|
| 3078 | - ? $this->builderCache->noEscape [ $selectKey ] |
|
| 3077 | + $noEscape = isset($this->builderCache->noEscape [$selectKey]) |
|
| 3078 | + ? $this->builderCache->noEscape [$selectKey] |
|
| 3079 | 3079 | : null; |
| 3080 | - $this->builderCache->select [ $selectKey ] = $this->conn->protectIdentifiers( |
|
| 3080 | + $this->builderCache->select [$selectKey] = $this->conn->protectIdentifiers( |
|
| 3081 | 3081 | $selectField, |
| 3082 | 3082 | false, |
| 3083 | 3083 | $noEscape |
@@ -3196,28 +3196,28 @@ discard block |
||
| 3196 | 3196 | if (count($this->builderCache->{$cacheKey}) > 0) {
|
| 3197 | 3197 | for ($i = 0, $c = count($this->builderCache->{$cacheKey}); $i < $c; $i++) {
|
| 3198 | 3198 | // Is this condition already compiled? |
| 3199 | - if (is_string($this->builderCache->{$cacheKey}[ $i ])) {
|
|
| 3199 | + if (is_string($this->builderCache->{$cacheKey}[$i])) {
|
|
| 3200 | 3200 | continue; |
| 3201 | - } elseif ($this->builderCache->{$cacheKey}[ $i ][ 'escape' ] === false) {
|
|
| 3202 | - $this->builderCache->{$cacheKey}[ $i ]
|
|
| 3203 | - = $this->builderCache->{$cacheKey}[ $i ][ 'condition' ];
|
|
| 3201 | + } elseif ($this->builderCache->{$cacheKey}[$i]['escape'] === false) {
|
|
| 3202 | + $this->builderCache->{$cacheKey}[$i]
|
|
| 3203 | + = $this->builderCache->{$cacheKey}[$i]['condition'];
|
|
| 3204 | 3204 | continue; |
| 3205 | 3205 | } |
| 3206 | 3206 | |
| 3207 | 3207 | // Split multiple conditions |
| 3208 | 3208 | $conditions = preg_split( |
| 3209 | 3209 | '/((?:^|\s+)AND\s+|(?:^|\s+)OR\s+)/i', |
| 3210 | - $this->builderCache->{$cacheKey}[ $i ][ 'condition' ],
|
|
| 3210 | + $this->builderCache->{$cacheKey}[$i]['condition'],
|
|
| 3211 | 3211 | -1, |
| 3212 | 3212 | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
| 3213 | 3213 | ); |
| 3214 | 3214 | |
| 3215 | 3215 | for ($ci = 0, $cc = count($conditions); $ci < $cc; $ci++) {
|
| 3216 | - if (($op = $this->getOperator($conditions[ $ci ])) === false |
|
| 3216 | + if (($op = $this->getOperator($conditions[$ci])) === false |
|
| 3217 | 3217 | OR |
| 3218 | 3218 | ! preg_match( |
| 3219 | 3219 | '/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(?<!\)))?(\)?)$/i',
|
| 3220 | - $conditions[ $ci ], |
|
| 3220 | + $conditions[$ci], |
|
| 3221 | 3221 | $matches |
| 3222 | 3222 | ) |
| 3223 | 3223 | ) {
|
@@ -3233,16 +3233,16 @@ discard block |
||
| 3233 | 3233 | // 5 => ')' /* optional */ |
| 3234 | 3234 | // ); |
| 3235 | 3235 | |
| 3236 | - if ( ! empty($matches[ 4 ])) {
|
|
| 3236 | + if ( ! empty($matches[4])) {
|
|
| 3237 | 3237 | //$this->isLiteral($matches[4]) OR $matches[4] = $this->protectIdentifiers(trim($matches[4])); |
| 3238 | - $matches[ 4 ] = ' ' . $matches[ 4 ]; |
|
| 3238 | + $matches[4] = ' ' . $matches[4]; |
|
| 3239 | 3239 | } |
| 3240 | 3240 | |
| 3241 | - $conditions[ $ci ] = $matches[ 1 ] . $this->conn->protectIdentifiers(trim($matches[ 2 ])) |
|
| 3242 | - . ' ' . trim($matches[ 3 ]) . $matches[ 4 ] . $matches[ 5 ]; |
|
| 3241 | + $conditions[$ci] = $matches[1] . $this->conn->protectIdentifiers(trim($matches[2])) |
|
| 3242 | + . ' ' . trim($matches[3]) . $matches[4] . $matches[5]; |
|
| 3243 | 3243 | } |
| 3244 | 3244 | |
| 3245 | - $this->builderCache->{$cacheKey}[ $i ] = implode('', $conditions);
|
|
| 3245 | + $this->builderCache->{$cacheKey}[$i] = implode('', $conditions);
|
|
| 3246 | 3246 | } |
| 3247 | 3247 | |
| 3248 | 3248 | if ($cacheKey === 'having') {
|
@@ -3281,17 +3281,17 @@ discard block |
||
| 3281 | 3281 | if (count($this->builderCache->groupBy) > 0) {
|
| 3282 | 3282 | for ($i = 0, $c = count($this->builderCache->groupBy); $i < $c; $i++) {
|
| 3283 | 3283 | // Is it already compiled? |
| 3284 | - if (is_string($this->builderCache->groupBy[ $i ])) {
|
|
| 3284 | + if (is_string($this->builderCache->groupBy[$i])) {
|
|
| 3285 | 3285 | continue; |
| 3286 | 3286 | } |
| 3287 | 3287 | |
| 3288 | - $this->builderCache->groupBy[ $i ] = ($this->builderCache->groupBy[ $i ][ 'escape' ] |
|
| 3288 | + $this->builderCache->groupBy[$i] = ($this->builderCache->groupBy[$i]['escape'] |
|
| 3289 | 3289 | === false OR |
| 3290 | 3290 | $this->isLiteral( |
| 3291 | - $this->builderCache->groupBy[ $i ][ 'field' ] |
|
| 3291 | + $this->builderCache->groupBy[$i]['field'] |
|
| 3292 | 3292 | )) |
| 3293 | - ? $this->builderCache->groupBy[ $i ][ 'field' ] |
|
| 3294 | - : $this->conn->protectIdentifiers($this->builderCache->groupBy[ $i ][ 'field' ]); |
|
| 3293 | + ? $this->builderCache->groupBy[$i]['field'] |
|
| 3294 | + : $this->conn->protectIdentifiers($this->builderCache->groupBy[$i]['field']); |
|
| 3295 | 3295 | } |
| 3296 | 3296 | |
| 3297 | 3297 | return "\n" . sprintf( |
@@ -3336,7 +3336,7 @@ discard block |
||
| 3336 | 3336 | : ["'"]; |
| 3337 | 3337 | } |
| 3338 | 3338 | |
| 3339 | - return in_array($string[ 0 ], $stringArray, true); |
|
| 3339 | + return in_array($string[0], $stringArray, true); |
|
| 3340 | 3340 | } |
| 3341 | 3341 | |
| 3342 | 3342 | //-------------------------------------------------------------------- |
@@ -3394,18 +3394,18 @@ discard block |
||
| 3394 | 3394 | {
|
| 3395 | 3395 | if (is_array($this->builderCache->orderBy) && count($this->builderCache->orderBy) > 0) {
|
| 3396 | 3396 | for ($i = 0, $c = count($this->builderCache->orderBy); $i < $c; $i++) {
|
| 3397 | - if ($this->builderCache->orderBy[ $i ][ 'escape' ] !== false |
|
| 3397 | + if ($this->builderCache->orderBy[$i]['escape'] !== false |
|
| 3398 | 3398 | && ! $this->isLiteral( |
| 3399 | - $this->builderCache->orderBy[ $i ][ 'field' ] |
|
| 3399 | + $this->builderCache->orderBy[$i]['field'] |
|
| 3400 | 3400 | ) |
| 3401 | 3401 | ) {
|
| 3402 | - $this->builderCache->orderBy[ $i ][ 'field' ] = $this->conn->protectIdentifiers( |
|
| 3403 | - $this->builderCache->orderBy[ $i ][ 'field' ] |
|
| 3402 | + $this->builderCache->orderBy[$i]['field'] = $this->conn->protectIdentifiers( |
|
| 3403 | + $this->builderCache->orderBy[$i]['field'] |
|
| 3404 | 3404 | ); |
| 3405 | 3405 | } |
| 3406 | 3406 | |
| 3407 | - $this->builderCache->orderBy[ $i ] = $this->builderCache->orderBy[ $i ][ 'field' ] |
|
| 3408 | - . $this->builderCache->orderBy[ $i ][ 'direction' ]; |
|
| 3407 | + $this->builderCache->orderBy[$i] = $this->builderCache->orderBy[$i]['field'] |
|
| 3408 | + . $this->builderCache->orderBy[$i]['direction']; |
|
| 3409 | 3409 | } |
| 3410 | 3410 | |
| 3411 | 3411 | return $this->builderCache->orderBy = "\n" . sprintf( |