@@ -37,7 +37,7 @@ |
||
37 | 37 | class LexerSplitter |
38 | 38 | { |
39 | 39 | private static $splitters = array("\r\n", '!=', '>=', '<=', '<>', ':=', '\\', '&&', '>', '<', '|', '=', '^', '(', |
40 | - ')', "\t", "\n", "'", '"', '`', ',', '@', ' ', '+', '-', '*', '/', ';', ); |
|
40 | + ')', "\t", "\n", "'", '"', '`', ',', '@', ' ', '+', '-', '*', '/', ';',); |
|
41 | 41 | private $tokenSize; |
42 | 42 | private $hashSet; |
43 | 43 |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | if (!empty($subTree) && !isset($subTree[0])) { |
336 | 336 | $subTree = StatementFactory::toObject($subTree); |
337 | 337 | } else { |
338 | - $subTree = array_map(function ($item) { |
|
338 | + $subTree = array_map(function($item) { |
|
339 | 339 | if (is_array($item)) { |
340 | 340 | return self::toObject($item); |
341 | 341 | } else { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | array('NOT'), |
366 | 366 | array('&&', 'AND'), |
367 | 367 | array('XOR'), |
368 | - array('||', 'OR'), ); |
|
368 | + array('||', 'OR'),); |
|
369 | 369 | |
370 | 370 | private static $OPERATOR_TO_CLASS = array( |
371 | 371 | '=' => 'SQLParser\Node\Equal', |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | { |
627 | 627 | $instanceDescriptor = $moufManager->createInstance(get_called_class()); |
628 | 628 | |
629 | - return self::array_map_deep($node, function ($item) use ($moufManager) { |
|
629 | + return self::array_map_deep($node, function($item) use ($moufManager) { |
|
630 | 630 | if ($item instanceof NodeInterface) { |
631 | 631 | return $item->toInstanceDescriptor($moufManager); |
632 | 632 | } else { |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | { |
671 | 671 | if (is_array($nodes)) { |
672 | 672 | $elems = array(); |
673 | - array_walk_recursive($nodes, function ($item) use (&$elems, $dbConnection, $indent, $delimiter, $parameters, $conditionsMode) { |
|
673 | + array_walk_recursive($nodes, function($item) use (&$elems, $dbConnection, $indent, $delimiter, $parameters, $conditionsMode) { |
|
674 | 674 | if ($item instanceof SqlRenderInterface) { |
675 | 675 | $itemSql = $item->toSql($parameters, $dbConnection, $indent, $conditionsMode); |
676 | 676 | if ($itemSql !== null) { |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function setName($name) |
70 | 70 | { |
71 | - if (strrpos($name, '!') === strlen($name)-1) { |
|
72 | - $this->name = substr($name, 0, strlen($name)-1); |
|
71 | + if (strrpos($name, '!') === strlen($name) - 1) { |
|
72 | + $this->name = substr($name, 0, strlen($name) - 1); |
|
73 | 73 | $this->discardedOnNull = false; |
74 | 74 | } else { |
75 | 75 | $this->name = $name; |
@@ -164,22 +164,22 @@ discard block |
||
164 | 164 | { |
165 | 165 | if (isset($parameters[$this->name])) { |
166 | 166 | if ($dbConnection) { |
167 | - if(is_array($parameters[$this->name])){ |
|
168 | - return '('.implode(',',array_map(function($item) use ($dbConnection) { |
|
167 | + if (is_array($parameters[$this->name])) { |
|
168 | + return '('.implode(',', array_map(function($item) use ($dbConnection) { |
|
169 | 169 | return $dbConnection->quote($this->autoPrepend.$item.$this->autoAppend); |
170 | 170 | }, $parameters[$this->name])).')'; |
171 | - } else{ |
|
171 | + } else { |
|
172 | 172 | return $dbConnection->quote($this->autoPrepend.$parameters[$this->name].$this->autoAppend); |
173 | 173 | } |
174 | 174 | } else { |
175 | 175 | if ($parameters[$this->name] === null) { |
176 | 176 | return "null"; |
177 | 177 | } else { |
178 | - if(is_array($parameters[$this->name])){ |
|
179 | - return '('.implode(',',array_map(function($item) { |
|
178 | + if (is_array($parameters[$this->name])) { |
|
179 | + return '('.implode(',', array_map(function($item) { |
|
180 | 180 | return "'".addslashes($this->autoPrepend.$item.$this->autoAppend)."'"; |
181 | 181 | }, $parameters[$this->name])).')'; |
182 | - } else{ |
|
182 | + } else { |
|
183 | 183 | return "'".addslashes($this->autoPrepend.$parameters[$this->name].$this->autoAppend)."'"; |
184 | 184 | } |
185 | 185 |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'TRAILING', 'TRUE', 'UNDO', 'UNION', 'UNIQUE', 'UNLOCK', 'UNSIGNED', 'UPDATE', |
99 | 99 | 'USAGE', 'USE', 'USER_RESOURCES', 'USING', 'UTC_DATE', 'UTC_TIME', |
100 | 100 | 'UTC_TIMESTAMP', 'VALUES', 'VARBINARY', 'VARCHAR', 'VARCHARACTER', 'VARYING', |
101 | - 'WHEN', 'WHERE', 'WHILE', 'WITH', 'WRITE', 'XOR', 'YEAR_MONTH', 'ZEROFILL', ); |
|
101 | + 'WHEN', 'WHERE', 'WHILE', 'WITH', 'WRITE', 'XOR', 'YEAR_MONTH', 'ZEROFILL',); |
|
102 | 102 | |
103 | 103 | protected static $parameterizedFunctions = array('ABS', 'ACOS', 'ADDDATE', 'ADDTIME', 'AES_ENCRYPT', 'AES_DECRYPT', |
104 | 104 | 'AGAINST', 'ASCII', 'ASIN', 'ATAN', 'AVG', 'BENCHMARK', 'BIN', |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | 'TIME_TO_SEC', 'TO_DAYS', 'TRIM', 'TRUNCATE', 'UCASE', |
132 | 132 | 'UNCOMPRESS', 'UNCOMPRESSED_LENGTH', 'UNHEX', 'UPPER', 'VAR_POP', |
133 | 133 | 'VAR_SAMP', 'VARIANCE', 'WEEK', 'WEEKDAY', 'WEEKOFYEAR', 'YEAR', |
134 | - 'YEARWEEK', ); |
|
134 | + 'YEARWEEK',); |
|
135 | 135 | |
136 | 136 | protected static $functions = array('ABS', 'ACOS', 'ADDDATE', 'ADDTIME', 'AES_ENCRYPT', 'AES_DECRYPT', 'AGAINST', |
137 | 137 | 'ASCII', 'ASIN', 'ATAN', 'AVG', 'BENCHMARK', 'BIN', 'BIT_AND', 'BIT_OR', |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | 'TIME_TO_SEC', 'TO_DAYS', 'TRIM', 'TRUNCATE', 'UCASE', 'UNCOMPRESS', |
163 | 163 | 'UNCOMPRESSED_LENGTH', 'UNHEX', 'UNIX_TIMESTAMP', 'UPPER', 'USER', 'UTC_DATE', |
164 | 164 | 'UTC_TIME', 'UTC_TIMESTAMP', 'UUID', 'VAR_POP', 'VAR_SAMP', 'VARIANCE', |
165 | - 'VERSION', 'WEEK', 'WEEKDAY', 'WEEKOFYEAR', 'YEAR', 'YEARWEEK', ); |
|
165 | + 'VERSION', 'WEEK', 'WEEKDAY', 'WEEKOFYEAR', 'YEAR', 'YEARWEEK',); |
|
166 | 166 | |
167 | 167 | protected static $aggregateFunctions = array('AVG', 'SUM', 'COUNT', 'MIN', 'MAX', 'STDDEV', 'STDDEV_SAMP', |
168 | 168 | 'STDDEV_POP', 'VARIANCE', 'VAR_SAMP', 'VAR_POP', 'GROUP_CONCAT', |
169 | - 'BIT_AND', 'BIT_OR', 'BIT_XOR', ); |
|
169 | + 'BIT_AND', 'BIT_OR', 'BIT_XOR',); |
|
170 | 170 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | { |
45 | 45 | private static $allowedOnOperator = array("\t", "\n", "\r", ' ', ',', '(', ')', '_', "'", '"'); |
46 | 46 | private static $allowedOnOther = array("\t", "\n", "\r", ' ', ',', '(', ')', '<', '>', '*', '+', '-', '/', '|', |
47 | - '&', '=', '!', ';', ); |
|
47 | + '&', '=', '!', ';',); |
|
48 | 48 | |
49 | 49 | private function printPos($text, $sql, $charPos, $key, $parsed, $backtracking) |
50 | 50 | { |
@@ -360,7 +360,7 @@ |
||
360 | 360 | if ($children) { |
361 | 361 | if (is_array($children)) { |
362 | 362 | foreach ($children as $key => $operand) { |
363 | - if($operand) { |
|
363 | + if ($operand) { |
|
364 | 364 | $result2 = $operand->walk($visitor); |
365 | 365 | if ($result2 === NodeTraverser::REMOVE_NODE) { |
366 | 366 | unset($children[$key]); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | if (isset($desc['SELECT'])) { |
49 | 49 | $select = new Select(); |
50 | 50 | |
51 | - $columns = array_map(function ($item) { |
|
51 | + $columns = array_map(function($item) { |
|
52 | 52 | return NodeFactory::toObject($item); |
53 | 53 | }, $desc['SELECT']); |
54 | 54 | $columns = NodeFactory::simplify($columns); |
@@ -91,11 +91,11 @@ |
||
91 | 91 | */ |
92 | 92 | public function toSql(array $parameters = array(), Connection $dbConnection = null, $indent = 0, $conditionsMode = self::CONDITION_APPLY) |
93 | 93 | { |
94 | - if($this->value === null) { |
|
94 | + if ($this->value === null) { |
|
95 | 95 | throw new \Exception('A limit parameter must be an integer'); |
96 | 96 | } |
97 | 97 | |
98 | - if(is_numeric($this->value)) { |
|
98 | + if (is_numeric($this->value)) { |
|
99 | 99 | return (int) $this->value; |
100 | 100 | } else if ($dbConnection != null) { |
101 | 101 | return $dbConnection->quote($this->value); |
@@ -58,6 +58,6 @@ |
||
58 | 58 | { |
59 | 59 | $name = parent::toSql($parameters, $dbConnection, $indent, $conditionsMode); |
60 | 60 | $name = str_replace("'", "", $name); |
61 | - return is_numeric($name) ? (int)$name : $name; |
|
61 | + return is_numeric($name) ? (int) $name : $name; |
|
62 | 62 | } |
63 | 63 | } |