Code Duplication    Length = 15-17 lines in 3 locations

src/Components/PartitionDefinition.php 1 location

@@ 159-173 (lines=15) @@
156
            } elseif ($state === 3) {
157
                $ret->type = $token->value;
158
                $state = 4;
159
            } elseif ($state === 4) {
160
                if ($token->value === 'MAXVALUE') {
161
                    $ret->expr = $token->value;
162
                } else {
163
                    $ret->expr = Expression::parse(
164
                        $parser,
165
                        $list,
166
                        array(
167
                            'parenthesesDelimited' => true,
168
                            'breakOnAlias' => true,
169
                        )
170
                    );
171
                }
172
                $state = 5;
173
            } elseif ($state === 5) {
174
                $ret->options = OptionsArray::parse($parser, $list, static::$OPTIONS);
175
                $state = 6;
176
            } elseif ($state === 6) {

src/Components/AlterOperation.php 1 location

@@ 211-226 (lines=16) @@
208
                }
209
210
                $state = 1;
211
            } elseif ($state === 1) {
212
                $ret->field = Expression::parse(
213
                    $parser,
214
                    $list,
215
                    array(
216
                        'breakOnAlias' => true,
217
                        'parseField' => 'column',
218
                    )
219
                );
220
                if ($ret->field === null) {
221
                    // No field was read. We go back one token so the next
222
                    // iteration will parse the same token, but in state 2.
223
                    --$list->idx;
224
                }
225
                $state = 2;
226
            } elseif ($state === 2) {
227
                if ($token->type === Token::TYPE_OPERATOR) {
228
                    if ($token->value === '(') {
229
                        ++$brackets;

src/Components/RenameOperation.php 1 location

@@ 124-140 (lines=17) @@
121
                    );
122
                    break;
123
                }
124
            } elseif ($state === 2) {
125
                $expr->new = Expression::parse(
126
                    $parser,
127
                    $list,
128
                    array(
129
                        'breakOnAlias' => true,
130
                        'parseField' => 'table',
131
                    )
132
                );
133
                if (empty($expr->new)) {
134
                    $parser->error(
135
                        'The new name of the table was expected.',
136
                        $token
137
                    );
138
                }
139
                $state = 3;
140
            } elseif ($state === 3) {
141
                if (($token->type === Token::TYPE_OPERATOR) && ($token->value === ',')) {
142
                    $ret[] = $expr;
143
                    $expr = new self();