@@ -85,7 +85,7 @@ |
||
85 | 85 | $sql = $this->getTwigEnvironment()->render($sql, $parameters); |
86 | 86 | } |
87 | 87 | |
88 | - $availableParameterKeys = array_keys(array_filter($parameters, static function($param) { return $param !== null;})); |
|
88 | + $availableParameterKeys = array_keys(array_filter($parameters, static function($param) { return $param !== null; })); |
|
89 | 89 | // We choose md4 because it is fast. |
90 | 90 | $cacheKey = 'request_build_'.hash('md4', $sql.'__'.implode('_/_', $availableParameterKeys)); |
91 | 91 | $newSql = $this->cache->fetch($cacheKey); |
@@ -168,7 +168,6 @@ |
||
168 | 168 | * @param NodeInterface $sqlNode |
169 | 169 | * @param array $parameters |
170 | 170 | * @param bool $extrapolateParameters Whether the parameters should be fed into the returned SQL query |
171 | - |
|
172 | 171 | * @return string |
173 | 172 | */ |
174 | 173 | public function toSql(NodeInterface $sqlNode, array $parameters = array(), bool $extrapolateParameters = true) |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | if (!empty($subTree) && !isset($subTree[0])) { |
453 | 453 | $subTree = StatementFactory::toObject($subTree); |
454 | 454 | } else { |
455 | - $subTree = array_map(function ($item) { |
|
455 | + $subTree = array_map(function($item) { |
|
456 | 456 | if (is_array($item)) { |
457 | 457 | return self::toObject($item); |
458 | 458 | } else { |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | array('NOT'), |
486 | 486 | array('&&', 'AND'), |
487 | 487 | array('XOR'), |
488 | - array('||', 'OR'), ); |
|
488 | + array('||', 'OR'),); |
|
489 | 489 | |
490 | 490 | private static $OPERATOR_TO_CLASS = array( |
491 | 491 | '=' => 'SQLParser\Node\Equal', |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | */ |
793 | 793 | public static function nodeToInstanceDescriptor($node, MoufManager $moufManager) |
794 | 794 | { |
795 | - return self::array_map_deep($node, function ($item) use ($moufManager) { |
|
795 | + return self::array_map_deep($node, function($item) use ($moufManager) { |
|
796 | 796 | if ($item instanceof NodeInterface) { |
797 | 797 | return $item->toInstanceDescriptor($moufManager); |
798 | 798 | } else { |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | { |
837 | 837 | if (is_array($nodes)) { |
838 | 838 | $elems = array(); |
839 | - array_walk_recursive($nodes, function ($item) use (&$elems, $dbConnection, $indent, $parameters, $conditionsMode, $extrapolateParameters) { |
|
839 | + array_walk_recursive($nodes, function($item) use (&$elems, $dbConnection, $indent, $parameters, $conditionsMode, $extrapolateParameters) { |
|
840 | 840 | if ($item instanceof SqlRenderInterface) { |
841 | 841 | $itemSql = $item->toSql($parameters, $dbConnection, $indent, $conditionsMode, $extrapolateParameters); |
842 | 842 | if ($itemSql !== null) { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | if ($extrapolateParameters && isset($parameters[$this->name])) { |
165 | 165 | if ($dbConnection) { |
166 | 166 | if (is_array($parameters[$this->name])) { |
167 | - return '('.implode(',', array_map(function ($item) use ($dbConnection) { |
|
167 | + return '('.implode(',', array_map(function($item) use ($dbConnection) { |
|
168 | 168 | return $dbConnection->quote($this->autoPrepend.$item.$this->autoAppend); |
169 | 169 | }, $parameters[$this->name])).')'; |
170 | 170 | } else { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | return 'null'; |
176 | 176 | } else { |
177 | 177 | if (is_array($parameters[$this->name])) { |
178 | - return '('.implode(',', array_map(function ($item) { |
|
178 | + return '('.implode(',', array_map(function($item) { |
|
179 | 179 | return "'".addslashes($this->autoPrepend.$item.$this->autoAppend)."'"; |
180 | 180 | }, $parameters[$this->name])).')'; |
181 | 181 | } else { |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | /** @var Twig_Extension_Core $twigExtensionCore */ |
35 | 35 | $twigExtensionCore = $twig->getExtension('Twig_Extension_Core'); |
36 | - $twigExtensionCore->setEscaper('sql', function () { |
|
36 | + $twigExtensionCore->setEscaper('sql', function() { |
|
37 | 37 | throw new ForbiddenTwigParameterInSqlException('You cannot use Twig expressions (like "{{ id }}"). Instead, you should use SQL parameters (like ":id"). Twig integration is limited to Twig statements (like "{% for .... %}"'); |
38 | 38 | }); |
39 | 39 |