@@ -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]; |
@@ -2077,7 +2077,7 @@ discard block |
||
| 2077 | 2077 | |
| 2078 | 2078 | $result = $this->conn->query($sqlStatement, $this->builderCache->binds); |
| 2079 | 2079 | |
| 2080 | - if($reset) {
|
|
| 2080 | + if ($reset) {
|
|
| 2081 | 2081 | $this->builderCache->reset(); |
| 2082 | 2082 | } |
| 2083 | 2083 | |
@@ -2195,13 +2195,13 @@ discard block |
||
| 2195 | 2195 | } |
| 2196 | 2196 | |
| 2197 | 2197 | $numrows = 0; |
| 2198 | - if($result = $this->conn->query($sqlStatement, $this->builderCache->binds)) {
|
|
| 2199 | - if($result->count()) {
|
|
| 2198 | + if ($result = $this->conn->query($sqlStatement, $this->builderCache->binds)) {
|
|
| 2199 | + if ($result->count()) {
|
|
| 2200 | 2200 | $numrows = $result->first()->numrows; |
| 2201 | 2201 | } |
| 2202 | 2202 | } |
| 2203 | 2203 | |
| 2204 | - if($reset) {
|
|
| 2204 | + if ($reset) {
|
|
| 2205 | 2205 | $this->builderCache->reset(); |
| 2206 | 2206 | } |
| 2207 | 2207 | |
@@ -2352,7 +2352,7 @@ discard block |
||
| 2352 | 2352 | if (count($this->builderCache->sets)) {
|
| 2353 | 2353 | $sqlStatement = $this->platformInsertStatement( |
| 2354 | 2354 | $this->conn->protectIdentifiers( |
| 2355 | - $this->builderCache->from[ 0 ], |
|
| 2355 | + $this->builderCache->from[0], |
|
| 2356 | 2356 | true, |
| 2357 | 2357 | $escape, |
| 2358 | 2358 | false |
@@ -2401,7 +2401,7 @@ discard block |
||
| 2401 | 2401 | foreach ($field as $key => $value) {
|
| 2402 | 2402 | if ($key === 'birthday' || $key === 'date') {
|
| 2403 | 2403 | if (is_array($value)) {
|
| 2404 | - $value = $value[ 'year' ] . '-' . $value[ 'month' ] . '-' . $value[ 'date' ]; |
|
| 2404 | + $value = $value['year'] . '-' . $value['month'] . '-' . $value['date']; |
|
| 2405 | 2405 | } elseif (is_object($value)) {
|
| 2406 | 2406 | $value = $value->year . '-' . $value->month . '-' . $value->date; |
| 2407 | 2407 | } |
@@ -2409,9 +2409,9 @@ discard block |
||
| 2409 | 2409 | $value = call_user_func_array($this->arrayObjectConversionMethod, [$value]); |
| 2410 | 2410 | } |
| 2411 | 2411 | |
| 2412 | - $this->builderCache->binds[ $key ] = $value; |
|
| 2413 | - $this->builderCache->sets[ $this->conn->protectIdentifiers($key, false, |
|
| 2414 | - $escape) ] = ':' . $key; |
|
| 2412 | + $this->builderCache->binds[$key] = $value; |
|
| 2413 | + $this->builderCache->sets[$this->conn->protectIdentifiers($key, false, |
|
| 2414 | + $escape)] = ':' . $key; |
|
| 2415 | 2415 | } |
| 2416 | 2416 | |
| 2417 | 2417 | return $this; |
@@ -2438,7 +2438,7 @@ discard block |
||
| 2438 | 2438 | foreach (get_object_vars($object) as $key => $value) {
|
| 2439 | 2439 | // There are some built in keys we need to ignore for this conversion |
| 2440 | 2440 | if ( ! is_object($value) && ! is_array($value) && $key !== '_parent_name') {
|
| 2441 | - $array[ $key ] = $value; |
|
| 2441 | + $array[$key] = $value; |
|
| 2442 | 2442 | } |
| 2443 | 2443 | } |
| 2444 | 2444 | |
@@ -2486,7 +2486,7 @@ discard block |
||
| 2486 | 2486 | $affectedRows = 0; |
| 2487 | 2487 | for ($i = 0, $total = count($sets); $i < $total; $i += $batchSize) {
|
| 2488 | 2488 | $Sql = $this->platformInsertBatchStatement( |
| 2489 | - $this->conn->protectIdentifiers($this->builderCache->from[ 0 ], true, $escape, false), |
|
| 2489 | + $this->conn->protectIdentifiers($this->builderCache->from[0], true, $escape, false), |
|
| 2490 | 2490 | $this->builderCache->keys, |
| 2491 | 2491 | array_slice($this->builderCache->sets, $i, $batchSize) |
| 2492 | 2492 | ); |
@@ -2587,8 +2587,8 @@ discard block |
||
| 2587 | 2587 | // There are some built in keys we need to ignore for this conversion |
| 2588 | 2588 | if ($field !== '_parent_name') {
|
| 2589 | 2589 | $i = 0; |
| 2590 | - foreach ($out[ $field ] as $data) {
|
|
| 2591 | - $array[ $i++ ][ $field ] = $data; |
|
| 2590 | + foreach ($out[$field] as $data) {
|
|
| 2591 | + $array[$i++][$field] = $data; |
|
| 2592 | 2592 | } |
| 2593 | 2593 | } |
| 2594 | 2594 | } |
@@ -2639,7 +2639,7 @@ discard block |
||
| 2639 | 2639 | if (count($this->builderCache->sets)) {
|
| 2640 | 2640 | $sqlStatement = $this->platformReplaceStatement( |
| 2641 | 2641 | $this->conn->protectIdentifiers( |
| 2642 | - $this->builderCache->from[ 0 ], |
|
| 2642 | + $this->builderCache->from[0], |
|
| 2643 | 2643 | true, |
| 2644 | 2644 | $escape, |
| 2645 | 2645 | false |
@@ -2702,7 +2702,7 @@ discard block |
||
| 2702 | 2702 | $affectedRows = 0; |
| 2703 | 2703 | for ($i = 0, $total = count($sets); $i < $total; $i += $batchSize) {
|
| 2704 | 2704 | $Sql = $this->platformReplaceStatement( |
| 2705 | - $this->conn->protectIdentifiers($this->builderCache->from[ 0 ], true, $escape, false), |
|
| 2705 | + $this->conn->protectIdentifiers($this->builderCache->from[0], true, $escape, false), |
|
| 2706 | 2706 | $this->builderCache->keys, |
| 2707 | 2707 | array_slice($this->builderCache->sets, $i, $batchSize) |
| 2708 | 2708 | ); |
@@ -2754,7 +2754,7 @@ discard block |
||
| 2754 | 2754 | if (count($this->builderCache->sets) && count($this->builderCache->from)) {
|
| 2755 | 2755 | $sqlStatement = $this->platformUpdateStatement( |
| 2756 | 2756 | $this->conn->protectIdentifiers( |
| 2757 | - $this->builderCache->from[ 0 ], |
|
| 2757 | + $this->builderCache->from[0], |
|
| 2758 | 2758 | true, |
| 2759 | 2759 | $escape, |
| 2760 | 2760 | false |
@@ -2815,7 +2815,7 @@ discard block |
||
| 2815 | 2815 | $affectedRows = 0; |
| 2816 | 2816 | for ($i = 0, $total = count($this->builderCache->sets); $i < $total; $i += $batchSize) {
|
| 2817 | 2817 | $sql = $this->platformUpdateBatchStatement( |
| 2818 | - $this->builderCache->from[ 0 ], |
|
| 2818 | + $this->builderCache->from[0], |
|
| 2819 | 2819 | array_slice($this->builderCache->sets, $i, $batchSize), |
| 2820 | 2820 | $this->conn->protectIdentifiers($index, false, $escape, false) |
| 2821 | 2821 | ); |
@@ -2827,7 +2827,7 @@ discard block |
||
| 2827 | 2827 | $affectedRows += $this->conn->getAffectedRows(); |
| 2828 | 2828 | } |
| 2829 | 2829 | |
| 2830 | - $this->builderCache[ 'where' ] = []; |
|
| 2830 | + $this->builderCache['where'] = []; |
|
| 2831 | 2831 | } |
| 2832 | 2832 | |
| 2833 | 2833 | if ( ! $this->testMode) {
|
@@ -2871,7 +2871,7 @@ discard block |
||
| 2871 | 2871 | |
| 2872 | 2872 | $bind = $this->bind($key, $value); |
| 2873 | 2873 | |
| 2874 | - $row[ $this->conn->protectIdentifiers($key, false, $escape) ] = ':' . $bind; |
|
| 2874 | + $row[$this->conn->protectIdentifiers($key, false, $escape)] = ':' . $bind; |
|
| 2875 | 2875 | } |
| 2876 | 2876 | |
| 2877 | 2877 | if ($indexSet === false) {
|
@@ -2922,7 +2922,7 @@ discard block |
||
| 2922 | 2922 | |
| 2923 | 2923 | $sqlStatement = $this->platformDeleteStatement( |
| 2924 | 2924 | $this->conn->protectIdentifiers( |
| 2925 | - $this->builderCache->from[ 0 ], |
|
| 2925 | + $this->builderCache->from[0], |
|
| 2926 | 2926 | true, |
| 2927 | 2927 | $this->conn->protectIdentifiers, |
| 2928 | 2928 | false |
@@ -3101,10 +3101,10 @@ discard block |
||
| 3101 | 3101 | // The reason we protect identifiers here rather than in the select() function |
| 3102 | 3102 | // is because until the user calls the from() function we don't know if there are aliases |
| 3103 | 3103 | foreach ($this->builderCache->select as $selectKey => $selectField) {
|
| 3104 | - $noEscape = isset($this->builderCache->noEscape [ $selectKey ]) |
|
| 3105 | - ? $this->builderCache->noEscape [ $selectKey ] |
|
| 3104 | + $noEscape = isset($this->builderCache->noEscape [$selectKey]) |
|
| 3105 | + ? $this->builderCache->noEscape [$selectKey] |
|
| 3106 | 3106 | : null; |
| 3107 | - $this->builderCache->select [ $selectKey ] = $this->conn->protectIdentifiers( |
|
| 3107 | + $this->builderCache->select [$selectKey] = $this->conn->protectIdentifiers( |
|
| 3108 | 3108 | $selectField, |
| 3109 | 3109 | false, |
| 3110 | 3110 | $noEscape |
@@ -3223,28 +3223,28 @@ discard block |
||
| 3223 | 3223 | if (count($this->builderCache->{$cacheKey}) > 0) {
|
| 3224 | 3224 | for ($i = 0, $c = count($this->builderCache->{$cacheKey}); $i < $c; $i++) {
|
| 3225 | 3225 | // Is this condition already compiled? |
| 3226 | - if (is_string($this->builderCache->{$cacheKey}[ $i ])) {
|
|
| 3226 | + if (is_string($this->builderCache->{$cacheKey}[$i])) {
|
|
| 3227 | 3227 | continue; |
| 3228 | - } elseif ($this->builderCache->{$cacheKey}[ $i ][ 'escape' ] === false) {
|
|
| 3229 | - $this->builderCache->{$cacheKey}[ $i ]
|
|
| 3230 | - = $this->builderCache->{$cacheKey}[ $i ][ 'condition' ];
|
|
| 3228 | + } elseif ($this->builderCache->{$cacheKey}[$i]['escape'] === false) {
|
|
| 3229 | + $this->builderCache->{$cacheKey}[$i]
|
|
| 3230 | + = $this->builderCache->{$cacheKey}[$i]['condition'];
|
|
| 3231 | 3231 | continue; |
| 3232 | 3232 | } |
| 3233 | 3233 | |
| 3234 | 3234 | // Split multiple conditions |
| 3235 | 3235 | $conditions = preg_split( |
| 3236 | 3236 | '/((?:^|\s+)AND\s+|(?:^|\s+)OR\s+)/i', |
| 3237 | - $this->builderCache->{$cacheKey}[ $i ][ 'condition' ],
|
|
| 3237 | + $this->builderCache->{$cacheKey}[$i]['condition'],
|
|
| 3238 | 3238 | -1, |
| 3239 | 3239 | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
| 3240 | 3240 | ); |
| 3241 | 3241 | |
| 3242 | 3242 | for ($ci = 0, $cc = count($conditions); $ci < $cc; $ci++) {
|
| 3243 | - if (($op = $this->getOperator($conditions[ $ci ])) === false |
|
| 3243 | + if (($op = $this->getOperator($conditions[$ci])) === false |
|
| 3244 | 3244 | OR |
| 3245 | 3245 | ! preg_match( |
| 3246 | 3246 | '/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(?<!\)))?(\)?)$/i',
|
| 3247 | - $conditions[ $ci ], |
|
| 3247 | + $conditions[$ci], |
|
| 3248 | 3248 | $matches |
| 3249 | 3249 | ) |
| 3250 | 3250 | ) {
|
@@ -3260,16 +3260,16 @@ discard block |
||
| 3260 | 3260 | // 5 => ')' /* optional */ |
| 3261 | 3261 | // ); |
| 3262 | 3262 | |
| 3263 | - if ( ! empty($matches[ 4 ])) {
|
|
| 3263 | + if ( ! empty($matches[4])) {
|
|
| 3264 | 3264 | //$this->isLiteral($matches[4]) OR $matches[4] = $this->protectIdentifiers(trim($matches[4])); |
| 3265 | - $matches[ 4 ] = ' ' . $matches[ 4 ]; |
|
| 3265 | + $matches[4] = ' ' . $matches[4]; |
|
| 3266 | 3266 | } |
| 3267 | 3267 | |
| 3268 | - $conditions[ $ci ] = $matches[ 1 ] . $this->conn->protectIdentifiers(trim($matches[ 2 ])) |
|
| 3269 | - . ' ' . trim($matches[ 3 ]) . $matches[ 4 ] . $matches[ 5 ]; |
|
| 3268 | + $conditions[$ci] = $matches[1] . $this->conn->protectIdentifiers(trim($matches[2])) |
|
| 3269 | + . ' ' . trim($matches[3]) . $matches[4] . $matches[5]; |
|
| 3270 | 3270 | } |
| 3271 | 3271 | |
| 3272 | - $this->builderCache->{$cacheKey}[ $i ] = implode('', $conditions);
|
|
| 3272 | + $this->builderCache->{$cacheKey}[$i] = implode('', $conditions);
|
|
| 3273 | 3273 | } |
| 3274 | 3274 | |
| 3275 | 3275 | if ($cacheKey === 'having') {
|
@@ -3308,17 +3308,17 @@ discard block |
||
| 3308 | 3308 | if (count($this->builderCache->groupBy) > 0) {
|
| 3309 | 3309 | for ($i = 0, $c = count($this->builderCache->groupBy); $i < $c; $i++) {
|
| 3310 | 3310 | // Is it already compiled? |
| 3311 | - if (is_string($this->builderCache->groupBy[ $i ])) {
|
|
| 3311 | + if (is_string($this->builderCache->groupBy[$i])) {
|
|
| 3312 | 3312 | continue; |
| 3313 | 3313 | } |
| 3314 | 3314 | |
| 3315 | - $this->builderCache->groupBy[ $i ] = ($this->builderCache->groupBy[ $i ][ 'escape' ] |
|
| 3315 | + $this->builderCache->groupBy[$i] = ($this->builderCache->groupBy[$i]['escape'] |
|
| 3316 | 3316 | === false OR |
| 3317 | 3317 | $this->isLiteral( |
| 3318 | - $this->builderCache->groupBy[ $i ][ 'field' ] |
|
| 3318 | + $this->builderCache->groupBy[$i]['field'] |
|
| 3319 | 3319 | )) |
| 3320 | - ? $this->builderCache->groupBy[ $i ][ 'field' ] |
|
| 3321 | - : $this->conn->protectIdentifiers($this->builderCache->groupBy[ $i ][ 'field' ]); |
|
| 3320 | + ? $this->builderCache->groupBy[$i]['field'] |
|
| 3321 | + : $this->conn->protectIdentifiers($this->builderCache->groupBy[$i]['field']); |
|
| 3322 | 3322 | } |
| 3323 | 3323 | |
| 3324 | 3324 | return "\n" . sprintf( |
@@ -3363,7 +3363,7 @@ discard block |
||
| 3363 | 3363 | : ["'"]; |
| 3364 | 3364 | } |
| 3365 | 3365 | |
| 3366 | - return in_array($string[ 0 ], $stringArray, true); |
|
| 3366 | + return in_array($string[0], $stringArray, true); |
|
| 3367 | 3367 | } |
| 3368 | 3368 | |
| 3369 | 3369 | //-------------------------------------------------------------------- |
@@ -3421,18 +3421,18 @@ discard block |
||
| 3421 | 3421 | {
|
| 3422 | 3422 | if (is_array($this->builderCache->orderBy) && count($this->builderCache->orderBy) > 0) {
|
| 3423 | 3423 | for ($i = 0, $c = count($this->builderCache->orderBy); $i < $c; $i++) {
|
| 3424 | - if ($this->builderCache->orderBy[ $i ][ 'escape' ] !== false |
|
| 3424 | + if ($this->builderCache->orderBy[$i]['escape'] !== false |
|
| 3425 | 3425 | && ! $this->isLiteral( |
| 3426 | - $this->builderCache->orderBy[ $i ][ 'field' ] |
|
| 3426 | + $this->builderCache->orderBy[$i]['field'] |
|
| 3427 | 3427 | ) |
| 3428 | 3428 | ) {
|
| 3429 | - $this->builderCache->orderBy[ $i ][ 'field' ] = $this->conn->protectIdentifiers( |
|
| 3430 | - $this->builderCache->orderBy[ $i ][ 'field' ] |
|
| 3429 | + $this->builderCache->orderBy[$i]['field'] = $this->conn->protectIdentifiers( |
|
| 3430 | + $this->builderCache->orderBy[$i]['field'] |
|
| 3431 | 3431 | ); |
| 3432 | 3432 | } |
| 3433 | 3433 | |
| 3434 | - $this->builderCache->orderBy[ $i ] = $this->builderCache->orderBy[ $i ][ 'field' ] |
|
| 3435 | - . $this->builderCache->orderBy[ $i ][ 'direction' ]; |
|
| 3434 | + $this->builderCache->orderBy[$i] = $this->builderCache->orderBy[$i]['field'] |
|
| 3435 | + . $this->builderCache->orderBy[$i]['direction']; |
|
| 3436 | 3436 | } |
| 3437 | 3437 | |
| 3438 | 3438 | return $this->builderCache->orderBy = "\n" . sprintf( |