@@ -505,7 +505,7 @@ |
||
| 505 | 505 | * @param Statement $statement The parsed query that has to be modified. |
| 506 | 506 | * @param TokensList $list The list of tokens. |
| 507 | 507 | * @param string $clause The clause to be returned. |
| 508 | - * @param int|string $type The type of the search. |
|
| 508 | + * @param integer $type The type of the search. |
|
| 509 | 509 | * If int, |
| 510 | 510 | * -1 for everything that was before |
| 511 | 511 | * 0 only for the clause |
@@ -651,13 +651,13 @@ discard block |
||
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | if ($onlyType) { |
| 654 | - return static::getClause($statement, $list, $old, -1, false).' '. |
|
| 655 | - $new.' '.static::getClause($statement, $list, $old, 0).' '. |
|
| 654 | + return static::getClause($statement, $list, $old, -1, false) . ' ' . |
|
| 655 | + $new . ' ' . static::getClause($statement, $list, $old, 0) . ' ' . |
|
| 656 | 656 | static::getClause($statement, $list, $old, 1, false); |
| 657 | 657 | } |
| 658 | 658 | |
| 659 | - return static::getClause($statement, $list, $old, -1, false).' '. |
|
| 660 | - $new.' '.static::getClause($statement, $list, $old, 1, false); |
|
| 659 | + return static::getClause($statement, $list, $old, -1, false) . ' ' . |
|
| 660 | + $new . ' ' . static::getClause($statement, $list, $old, 1, false); |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | /** |
@@ -699,15 +699,15 @@ discard block |
||
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | // Adding everything before first replacement. |
| 702 | - $ret .= static::getClause($statement, $list, $ops[0][0], -1).' '; |
|
| 702 | + $ret .= static::getClause($statement, $list, $ops[0][0], -1) . ' '; |
|
| 703 | 703 | |
| 704 | 704 | // Doing replacements. |
| 705 | 705 | for ($i = 0; $i < $count; ++$i) { |
| 706 | - $ret .= $ops[$i][1].' '; |
|
| 706 | + $ret .= $ops[$i][1] . ' '; |
|
| 707 | 707 | |
| 708 | 708 | // Adding everything between this and next replacement. |
| 709 | 709 | if ($i + 1 !== $count) { |
| 710 | - $ret .= static::getClause($statement, $list, $ops[$i][0], $ops[$i + 1][0]).' '; |
|
| 710 | + $ret .= static::getClause($statement, $list, $ops[$i][0], $ops[$i + 1][0]) . ' '; |
|
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | 713 | |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | * @param Parser $parser The parser that serves as context. |
| 78 | 78 | * @param TokensList $list The list of tokens that are being parsed. |
| 79 | 79 | * |
| 80 | - * @return Expression |
|
| 80 | + * @return CaseExpression |
|
| 81 | 81 | */ |
| 82 | 82 | public static function parse(Parser $parser, TokensList $list) |
| 83 | 83 | { |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | $ret = 'CASE '; |
| 213 | 213 | if (isset($component->value)) { |
| 214 | 214 | // Syntax type 0 |
| 215 | - $ret .= $component->value.' '; |
|
| 215 | + $ret .= $component->value . ' '; |
|
| 216 | 216 | for ( |
| 217 | 217 | $i = 0; |
| 218 | 218 | $i < count($component->compare_values) && $i < count($component->results); |
| 219 | 219 | ++$i |
| 220 | 220 | ) { |
| 221 | - $ret .= 'WHEN '.$component->compare_values[$i].' '; |
|
| 222 | - $ret .= 'THEN '.$component->results[$i].' '; |
|
| 221 | + $ret .= 'WHEN ' . $component->compare_values[$i] . ' '; |
|
| 222 | + $ret .= 'THEN ' . $component->results[$i] . ' '; |
|
| 223 | 223 | } |
| 224 | 224 | } else { |
| 225 | 225 | // Syntax type 1 |
@@ -228,12 +228,12 @@ discard block |
||
| 228 | 228 | $i < count($component->conditions) && $i < count($component->results); |
| 229 | 229 | ++$i |
| 230 | 230 | ) { |
| 231 | - $ret .= 'WHEN '.Condition::build($component->conditions[$i]).' '; |
|
| 232 | - $ret .= 'THEN '.$component->results[$i].' '; |
|
| 231 | + $ret .= 'WHEN ' . Condition::build($component->conditions[$i]) . ' '; |
|
| 232 | + $ret .= 'THEN ' . $component->results[$i] . ' '; |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | if (isset($component->else_result)) { |
| 236 | - $ret .= 'ELSE '.$component->else_result.' '; |
|
| 236 | + $ret .= 'ELSE ' . $component->else_result . ' '; |
|
| 237 | 237 | } |
| 238 | 238 | $ret .= 'END'; |
| 239 | 239 | |
@@ -194,7 +194,7 @@ |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | - * @param PartitionDefinition|PartitionDefinition[] $component the component to be built |
|
| 197 | + * @param PartitionDefinition[] $component the component to be built |
|
| 198 | 198 | * @param array $options parameters for building |
| 199 | 199 | * |
| 200 | 200 | * @return string |
@@ -202,18 +202,18 @@ |
||
| 202 | 202 | public static function build($component, array $options = array()) |
| 203 | 203 | { |
| 204 | 204 | if (is_array($component)) { |
| 205 | - return "(\n".implode(",\n", $component)."\n)"; |
|
| 205 | + return "(\n" . implode(",\n", $component) . "\n)"; |
|
| 206 | 206 | } else { |
| 207 | 207 | if ($component->isSubpartition) { |
| 208 | - return trim('SUBPARTITION '.$component->name.' '.$component->options); |
|
| 208 | + return trim('SUBPARTITION ' . $component->name . ' ' . $component->options); |
|
| 209 | 209 | } else { |
| 210 | 210 | $subpartitions = empty($component->subpartitions) |
| 211 | - ? '' : ' '.self::build($component->subpartitions); |
|
| 211 | + ? '' : ' ' . self::build($component->subpartitions); |
|
| 212 | 212 | |
| 213 | 213 | return trim( |
| 214 | - 'PARTITION '.$component->name |
|
| 215 | - .(empty($component->type) ? '' : ' VALUES '.$component->type.' '.$component->expr.' ') |
|
| 216 | - .$component->options.$subpartitions |
|
| 214 | + 'PARTITION ' . $component->name |
|
| 215 | + .(empty($component->type) ? '' : ' VALUES ' . $component->type . ' ' . $component->expr . ' ') |
|
| 216 | + .$component->options . $subpartitions |
|
| 217 | 217 | ); |
| 218 | 218 | } |
| 219 | 219 | } |
@@ -52,15 +52,15 @@ |
||
| 52 | 52 | * @var array |
| 53 | 53 | */ |
| 54 | 54 | public static $CLAUSES = array( |
| 55 | - 'UPDATE' => array('UPDATE', 2), |
|
| 55 | + 'UPDATE' => array('UPDATE', 2), |
|
| 56 | 56 | // Used for options. |
| 57 | - '_OPTIONS' => array('_OPTIONS', 1), |
|
| 57 | + '_OPTIONS' => array('_OPTIONS', 1), |
|
| 58 | 58 | // Used for updated tables. |
| 59 | - '_UPDATE' => array('UPDATE', 1), |
|
| 60 | - 'SET' => array('SET', 3), |
|
| 61 | - 'WHERE' => array('WHERE', 3), |
|
| 62 | - 'ORDER BY' => array('ORDER BY', 3), |
|
| 63 | - 'LIMIT' => array('LIMIT', 3), |
|
| 59 | + '_UPDATE' => array('UPDATE', 1), |
|
| 60 | + 'SET' => array('SET', 3), |
|
| 61 | + 'WHERE' => array('WHERE', 3), |
|
| 62 | + 'ORDER BY' => array('ORDER BY', 3), |
|
| 63 | + 'LIMIT' => array('LIMIT', 3), |
|
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -143,8 +143,8 @@ |
||
| 143 | 143 | $tmp[] = $altered::build($altered); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - return 'ALTER '.OptionsArray::build($this->options) |
|
| 147 | - .' '.Expression::build($this->table) |
|
| 148 | - .' '.implode(', ', $tmp); |
|
| 146 | + return 'ALTER ' . OptionsArray::build($this->options) |
|
| 147 | + .' ' . Expression::build($this->table) |
|
| 148 | + .' ' . implode(', ', $tmp); |
|
| 149 | 149 | } |
| 150 | 150 | } |
@@ -87,15 +87,15 @@ |
||
| 87 | 87 | */ |
| 88 | 88 | public function build() |
| 89 | 89 | { |
| 90 | - $ret = 'REPLACE '.$this->options |
|
| 91 | - .' INTO '.$this->into; |
|
| 90 | + $ret = 'REPLACE ' . $this->options |
|
| 91 | + .' INTO ' . $this->into; |
|
| 92 | 92 | |
| 93 | 93 | if ($this->values != null && count($this->values) > 0) { |
| 94 | - $ret .= ' VALUES '.Array2d::build($this->values); |
|
| 94 | + $ret .= ' VALUES ' . Array2d::build($this->values); |
|
| 95 | 95 | } elseif ($this->set != null && count($this->set) > 0) { |
| 96 | - $ret .= ' SET '.SetOperation::build($this->set); |
|
| 96 | + $ret .= ' SET ' . SetOperation::build($this->set); |
|
| 97 | 97 | } elseif ($this->select != null && strlen($this->select) > 0) { |
| 98 | - $ret .= ' '.$this->select->build(); |
|
| 98 | + $ret .= ' ' . $this->select->build(); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | return $ret; |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function build() |
| 36 | 36 | { |
| 37 | 37 | // Building the parsed part of the query (if any). |
| 38 | - $query = parent::build().' '; |
|
| 38 | + $query = parent::build() . ' '; |
|
| 39 | 39 | |
| 40 | 40 | // Rebuilding the unknown part from tokens. |
| 41 | 41 | foreach ($this->unknown as $token) { |
@@ -67,15 +67,15 @@ discard block |
||
| 67 | 67 | * @var array |
| 68 | 68 | */ |
| 69 | 69 | public static $CLAUSES = array( |
| 70 | - 'DELETE' => array('DELETE', 2), |
|
| 70 | + 'DELETE' => array('DELETE', 2), |
|
| 71 | 71 | // Used for options. |
| 72 | - '_OPTIONS' => array('_OPTIONS', 1), |
|
| 73 | - 'FROM' => array('FROM', 3), |
|
| 74 | - 'PARTITION' => array('PARTITION', 3), |
|
| 75 | - 'USING' => array('USING', 3), |
|
| 76 | - 'WHERE' => array('WHERE', 3), |
|
| 77 | - 'ORDER BY' => array('ORDER BY', 3), |
|
| 78 | - 'LIMIT' => array('LIMIT', 3), |
|
| 72 | + '_OPTIONS' => array('_OPTIONS', 1), |
|
| 73 | + 'FROM' => array('FROM', 3), |
|
| 74 | + 'PARTITION' => array('PARTITION', 3), |
|
| 75 | + 'USING' => array('USING', 3), |
|
| 76 | + 'WHERE' => array('WHERE', 3), |
|
| 77 | + 'ORDER BY' => array('ORDER BY', 3), |
|
| 78 | + 'LIMIT' => array('LIMIT', 3), |
|
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -132,25 +132,25 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function build() |
| 134 | 134 | { |
| 135 | - $ret = 'DELETE '.OptionsArray::build($this->options); |
|
| 135 | + $ret = 'DELETE ' . OptionsArray::build($this->options); |
|
| 136 | 136 | |
| 137 | 137 | if ($this->columns != null && count($this->columns) > 0) { |
| 138 | - $ret .= ' '.ExpressionArray::build($this->columns); |
|
| 138 | + $ret .= ' ' . ExpressionArray::build($this->columns); |
|
| 139 | 139 | } |
| 140 | 140 | if ($this->from != null && count($this->from) > 0) { |
| 141 | - $ret .= ' FROM '.ExpressionArray::build($this->from); |
|
| 141 | + $ret .= ' FROM ' . ExpressionArray::build($this->from); |
|
| 142 | 142 | } |
| 143 | 143 | if ($this->using != null && count($this->using) > 0) { |
| 144 | - $ret .= ' USING '.ExpressionArray::build($this->using); |
|
| 144 | + $ret .= ' USING ' . ExpressionArray::build($this->using); |
|
| 145 | 145 | } |
| 146 | 146 | if ($this->where != null && count($this->where) > 0) { |
| 147 | - $ret .= ' WHERE '.Condition::build($this->where); |
|
| 147 | + $ret .= ' WHERE ' . Condition::build($this->where); |
|
| 148 | 148 | } |
| 149 | 149 | if ($this->order != null && count($this->order) > 0) { |
| 150 | - $ret .= ' ORDER BY '.ExpressionArray::build($this->order); |
|
| 150 | + $ret .= ' ORDER BY ' . ExpressionArray::build($this->order); |
|
| 151 | 151 | } |
| 152 | 152 | if ($this->limit != null && strlen($this->limit) > 0) { |
| 153 | - $ret .= ' LIMIT '.Limit::build($this->limit); |
|
| 153 | + $ret .= ' LIMIT ' . Limit::build($this->limit); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | return $ret; |
@@ -49,12 +49,12 @@ |
||
| 49 | 49 | * @var array |
| 50 | 50 | */ |
| 51 | 51 | public static $CLAUSES = array( |
| 52 | - 'DROP' => array('DROP', 2), |
|
| 52 | + 'DROP' => array('DROP', 2), |
|
| 53 | 53 | // Used for options. |
| 54 | - '_OPTIONS' => array('_OPTIONS', 1), |
|
| 54 | + '_OPTIONS' => array('_OPTIONS', 1), |
|
| 55 | 55 | // Used for select expressions. |
| 56 | - 'DROP_' => array('DROP', 1), |
|
| 57 | - 'ON' => array('ON', 3), |
|
| 56 | + 'DROP_' => array('DROP', 1), |
|
| 57 | + 'ON' => array('ON', 3), |
|
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | 60 | /** |