@@ -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 |
@@ -499,7 +499,7 @@ |
||
| 499 | 499 | * @param Statement $statement the parsed query that has to be modified |
| 500 | 500 | * @param TokensList $list the list of tokens |
| 501 | 501 | * @param string $clause the clause to be returned |
| 502 | - * @param int|string $type The type of the search. |
|
| 502 | + * @param integer $type The type of the search. |
|
| 503 | 503 | * If int, |
| 504 | 504 | * -1 for everything that was before |
| 505 | 505 | * 0 only for the clause |
@@ -339,6 +339,11 @@ |
||
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | + /** |
|
| 343 | + * @param Parser $parser |
|
| 344 | + * @param TokensList $list |
|
| 345 | + * @param integer $state |
|
| 346 | + */ |
|
| 342 | 347 | public function parseKeywordsAccordingToState($parser, $list, $state) |
| 343 | 348 | { |
| 344 | 349 | $token = $list->tokens[$list->idx]; |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | - * @param SetOperation|SetOperation[] $component the component to be built |
|
| 134 | + * @param SetOperation[] $component the component to be built |
|
| 135 | 135 | * @param array $options parameters for building |
| 136 | 136 | * |
| 137 | 137 | * @return string |
@@ -308,7 +308,7 @@ |
||
| 308 | 308 | * Checks if the given string is the beginning of a whitespace. |
| 309 | 309 | * |
| 310 | 310 | * @param string $str string to be checked |
| 311 | - * @param mixed $end |
|
| 311 | + * @param boolean $end |
|
| 312 | 312 | * |
| 313 | 313 | * @return int the appropriate flag for the comment type |
| 314 | 314 | */ |
@@ -498,7 +498,7 @@ |
||
| 498 | 498 | $i -= 2; |
| 499 | 499 | $part = substr($context, $i, 2); |
| 500 | 500 | /* No more numeric parts to strip */ |
| 501 | - if (! is_numeric($part)) { |
|
| 501 | + if (!is_numeric($part)) { |
|
| 502 | 502 | break 2; |
| 503 | 503 | } |
| 504 | 504 | } while (intval($part) === 0 && $i > 0); |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | * @param TokensList $list the list of tokens that are being parsed |
| 74 | 74 | * @param array $options parameters for parsing |
| 75 | 75 | * |
| 76 | - * @return component |
|
| 76 | + * @return Check |
|
| 77 | 77 | */ |
| 78 | 78 | public static function parse(Parser $parser, TokensList $list, array $options = array()) |
| 79 | 79 | { |
@@ -161,7 +161,9 @@ |
||
| 161 | 161 | if(count($bracketStack) > 1) { |
| 162 | 162 | array_pop($bracketStack); |
| 163 | 163 | $state = 2; |
| 164 | - } else $state = 5; |
|
| 164 | + } else { |
|
| 165 | + $state = 5; |
|
| 166 | + } |
|
| 165 | 167 | } elseif(in_array($token->value, self::$operatorsArray)) { |
| 166 | 168 | $ret->operators[] = $token->value; |
| 167 | 169 | $state = 3; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | if ($state === 0) { |
| 132 | 132 | if (($token->type === Token::TYPE_KEYWORD) && $token->keyword === 'CHECK') { |
| 133 | 133 | $state = 0; |
| 134 | - } elseif(($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
|
| 134 | + } elseif (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
|
| 135 | 135 | $state = 1; |
| 136 | 136 | array_push($bracketStack, '('); |
| 137 | 137 | } else { |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | ); |
| 142 | 142 | return $ret; |
| 143 | 143 | } |
| 144 | - } else if($state === 1) { |
|
| 145 | - if(($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
|
| 144 | + } else if ($state === 1) { |
|
| 145 | + if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
|
| 146 | 146 | array_push($bracketStack, '('); |
| 147 | 147 | $state = 1; |
| 148 | - } elseif($token->type === Token::TYPE_OPERATOR) { |
|
| 148 | + } elseif ($token->type === Token::TYPE_OPERATOR) { |
|
| 149 | 149 | $parser->error( |
| 150 | 150 | 'A Column name was expected!', |
| 151 | 151 | $token |
@@ -156,13 +156,13 @@ discard block |
||
| 156 | 156 | $state = 2; |
| 157 | 157 | } |
| 158 | 158 | } elseif ($state === 2) { |
| 159 | - if(($token->type === Token::TYPE_OPERATOR) || in_array($token->value, self::$operatorsArray)) { |
|
| 160 | - if(($token->value === ')')) { |
|
| 161 | - if(count($bracketStack) > 1) { |
|
| 159 | + if (($token->type === Token::TYPE_OPERATOR) || in_array($token->value, self::$operatorsArray)) { |
|
| 160 | + if (($token->value === ')')) { |
|
| 161 | + if (count($bracketStack) > 1) { |
|
| 162 | 162 | array_pop($bracketStack); |
| 163 | 163 | $state = 2; |
| 164 | 164 | } else $state = 5; |
| 165 | - } elseif(in_array($token->value, self::$operatorsArray)) { |
|
| 165 | + } elseif (in_array($token->value, self::$operatorsArray)) { |
|
| 166 | 166 | $ret->operators[] = $token->value; |
| 167 | 167 | $state = 3; |
| 168 | 168 | } else { |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | return $ret; |
| 181 | 181 | } |
| 182 | 182 | } elseif ($state === 3) { |
| 183 | - if(($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
|
| 183 | + if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
|
| 184 | 184 | $state = 3; |
| 185 | 185 | array_push($bracketStack, '('); |
| 186 | - } elseif($token->type === Token::TYPE_OPERATOR) { |
|
| 186 | + } elseif ($token->type === Token::TYPE_OPERATOR) { |
|
| 187 | 187 | $parser->error( |
| 188 | 188 | 'An operand was expected!', |
| 189 | 189 | $token |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | $ret->logicalOperators[] = $token->value; |
| 199 | 199 | $state = 1; |
| 200 | 200 | } elseif (($token->type === Token::TYPE_OPERATOR) && ($token->value === ')')) { |
| 201 | - if(count($bracketStack) === 1) { |
|
| 201 | + if (count($bracketStack) === 1) { |
|
| 202 | 202 | $state = 5; |
| 203 | 203 | } else { |
| 204 | 204 | array_pop($bracketStack); |
| 205 | 205 | $state = 4; |
| 206 | 206 | } |
| 207 | - } elseif($token->type === Token::TYPE_OPERATOR) { |
|
| 207 | + } elseif ($token->type === Token::TYPE_OPERATOR) { |
|
| 208 | 208 | $parser->error( |
| 209 | 209 | 'Unrecognized token!', |
| 210 | 210 | $token |
@@ -236,13 +236,13 @@ discard block |
||
| 236 | 236 | $operators = $component->operators; |
| 237 | 237 | $operands = $component->operands; |
| 238 | 238 | $definition = 'CHECK ('; |
| 239 | - for($i=0; $i<count($columns); ++$i) { |
|
| 239 | + for ($i = 0; $i < count($columns); ++$i) { |
|
| 240 | 240 | $columns[$i] = trim($columns[$i]); |
| 241 | - if($i>0) { |
|
| 242 | - $definition .= ' ' . $logical_op[$i-1] . ' '; |
|
| 241 | + if ($i > 0) { |
|
| 242 | + $definition .= ' ' . $logical_op[$i - 1] . ' '; |
|
| 243 | 243 | } |
| 244 | 244 | $definition .= Context::escape($columns[$i]); |
| 245 | - if($operators[$i] === 'IS NULL' || $operators[$i] === 'IS NOT NULL') { |
|
| 245 | + if ($operators[$i] === 'IS NULL' || $operators[$i] === 'IS NOT NULL') { |
|
| 246 | 246 | $definition .= ' ' . $operators[$i]; |
| 247 | 247 | } else { |
| 248 | 248 | $definition .= ' ' . $operators[$i] . ' \'' . $operands[$i] . '\''; |