Code Duplication    Length = 15-17 lines in 3 locations

src/Components/AlterOperation.php 1 location

@@ 194-209 (lines=16) @@
191
                }
192
193
                $state = 1;
194
            } elseif ($state === 1) {
195
                $ret->field = Expression::parse(
196
                    $parser,
197
                    $list,
198
                    array(
199
                        'breakOnAlias' => true,
200
                        'parseField' => 'column',
201
                    )
202
                );
203
                if ($ret->field === null) {
204
                    // No field was read. We go back one token so the next
205
                    // iteration will parse the same token, but in state 2.
206
                    --$list->idx;
207
                }
208
                $state = 2;
209
            } elseif ($state === 2) {
210
                if ($token->type === Token::TYPE_OPERATOR) {
211
                    if ($token->value === '(') {
212
                        ++$brackets;

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/RenameOperation.php 1 location

@@ 112-128 (lines=17) @@
109
                    );
110
                    break;
111
                }
112
            } elseif ($state === 2) {
113
                $expr->new = Expression::parse(
114
                    $parser,
115
                    $list,
116
                    array(
117
                        'breakOnAlias' => true,
118
                        'parseField' => 'table',
119
                    )
120
                );
121
                if (empty($expr->new)) {
122
                    $parser->error(
123
                        'The new name of the table was expected.',
124
                        $token
125
                    );
126
                }
127
                $state = 3;
128
            } elseif ($state === 3) {
129
                if (($token->type === Token::TYPE_OPERATOR) && ($token->value === ',')) {
130
                    $ret[] = $expr;
131
                    $expr = new self();