Code Duplication    Length = 10-10 lines in 6 locations

source/Spiral/Database/Entities/AbstractHandler.php 6 locations

@@ 145-154 (lines=10) @@
142
143
        //todo: indexes and foreign keys dropped with columns (!!!!)
144
145
        if ($behaviour & self::DROP_FOREIGNS) {
146
            foreach ($comparator->droppedForeigns() as $foreign) {
147
                $this->log('Dropping foreign key [{statement}] from table {table}.', [
148
                    'statement' => $foreign->sqlStatement($this->driver),
149
                    'table'     => $this->identify($table),
150
                ]);
151
152
                $this->dropForeign($table, $foreign);
153
            }
154
        }
155
156
        if ($behaviour & self::DROP_INDEXES) {
157
            foreach ($comparator->droppedIndexes() as $index) {
@@ 156-165 (lines=10) @@
153
            }
154
        }
155
156
        if ($behaviour & self::DROP_INDEXES) {
157
            foreach ($comparator->droppedIndexes() as $index) {
158
                $this->log('Dropping index [{statement}] from table {table}.', [
159
                    'statement' => $index->sqlStatement($this->driver),
160
                    'table'     => $this->identify($table),
161
                ]);
162
163
                $this->dropIndex($table, $index);
164
            }
165
        }
166
167
        if ($behaviour & self::DROP_COLUMNS) {
168
            foreach ($comparator->droppedColumns() as $column) {
@@ 167-176 (lines=10) @@
164
            }
165
        }
166
167
        if ($behaviour & self::DROP_COLUMNS) {
168
            foreach ($comparator->droppedColumns() as $column) {
169
                $this->log('Dropping column [{statement}] from table {table}.', [
170
                    'statement' => $column->sqlStatement($this->driver),
171
                    'table'     => $this->identify($table),
172
                ]);
173
174
                $this->dropColumn($table, $column);
175
            }
176
        }
177
178
        if ($behaviour & self::CREATE_COLUMNS) {
179
            foreach ($comparator->addedColumns() as $column) {
@@ 178-187 (lines=10) @@
175
            }
176
        }
177
178
        if ($behaviour & self::CREATE_COLUMNS) {
179
            foreach ($comparator->addedColumns() as $column) {
180
                $this->log('Adding column [{statement}] into table {table}.', [
181
                    'statement' => $column->sqlStatement($this->driver),
182
                    'table'     => $this->identify($table),
183
                ]);
184
185
                $this->createColumn($table, $column);
186
            }
187
        }
188
189
        if ($behaviour & self::ALTER_COLUMNS) {
190
            foreach ($comparator->alteredColumns() as $pair) {
@@ 207-216 (lines=10) @@
204
            }
205
        }
206
207
        if ($behaviour & self::CREATE_INDEXES) {
208
            foreach ($comparator->addedIndexes() as $index) {
209
                $this->log('Adding index [{statement}] into table {table}.', [
210
                    'statement' => $index->sqlStatement($this->driver),
211
                    'table'     => $this->identify($table),
212
                ]);
213
214
                $this->createIndex($table, $index);
215
            }
216
        }
217
218
        if ($behaviour & self::ALTER_INDEXES) {
219
            foreach ($comparator->alteredIndexes() as $pair) {
@@ 236-245 (lines=10) @@
233
            }
234
        }
235
236
        if ($behaviour & self::CREATE_FOREIGNS) {
237
            foreach ($comparator->addedForeigns() as $foreign) {
238
                $this->log('Adding foreign key [{statement}] into table {table}.', [
239
                    'statement' => $foreign->sqlStatement($this->driver),
240
                    'table'     => $this->identify($table),
241
                ]);
242
243
                $this->createForeign($table, $foreign);
244
            }
245
        }
246
247
        if ($behaviour & self::ALTER_FOREIGNS) {
248
            foreach ($comparator->alteredForeigns() as $pair) {