Code Duplication    Length = 9-11 lines in 8 locations

src/Phinx/Db/Adapter/TablePrefixAdapter.php 7 locations

@@ 129-137 (lines=9) @@
126
    /**
127
     * {@inheritdoc}
128
     */
129
    public function dropTable($tableName)
130
    {
131
        $adapter = $this->getAdapter();
132
        if (!$adapter instanceof DirectActionInterface) {
133
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
134
        }
135
        $adapterTableName = $this->getAdapterTableName($tableName);
136
        $adapter->dropTable($adapterTableName);
137
    }
138
139
    /**
140
     * {@inheritdoc}
@@ 185-193 (lines=9) @@
182
    /**
183
     * {@inheritdoc}
184
     */
185
    public function renameColumn($tableName, $columnName, $newColumnName)
186
    {
187
        $adapter = $this->getAdapter();
188
        if (!$adapter instanceof DirectActionInterface) {
189
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
190
        }
191
        $adapterTableName = $this->getAdapterTableName($tableName);
192
        $adapter->renameColumn($adapterTableName, $columnName, $newColumnName);
193
    }
194
195
    /**
196
     * {@inheritdoc}
@@ 198-206 (lines=9) @@
195
    /**
196
     * {@inheritdoc}
197
     */
198
    public function changeColumn($tableName, $columnName, Column $newColumn)
199
    {
200
        $adapter = $this->getAdapter();
201
        if (!$adapter instanceof DirectActionInterface) {
202
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
203
        }
204
        $adapterTableName = $this->getAdapterTableName($tableName);
205
        $adapter->changeColumn($adapterTableName, $columnName, $newColumn);
206
    }
207
208
    /**
209
     * {@inheritdoc}
@@ 211-219 (lines=9) @@
208
    /**
209
     * {@inheritdoc}
210
     */
211
    public function dropColumn($tableName, $columnName)
212
    {
213
        $adapter = $this->getAdapter();
214
        if (!$adapter instanceof DirectActionInterface) {
215
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
216
        }
217
        $adapterTableName = $this->getAdapterTableName($tableName);
218
        $adapter->dropColumn($adapterTableName, $columnName);
219
    }
220
221
    /**
222
     * {@inheritdoc}
@@ 257-265 (lines=9) @@
254
    /**
255
     * {@inheritdoc}
256
     */
257
    public function dropIndex($tableName, $columns)
258
    {
259
        $adapter = $this->getAdapter();
260
        if (!$adapter instanceof DirectActionInterface) {
261
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
262
        }
263
        $adapterTableName = $this->getAdapterTableName($tableName);
264
        $adapter->dropIndex($adapterTableName, $columns);
265
    }
266
267
    /**
268
     * {@inheritdoc}
@@ 270-278 (lines=9) @@
267
    /**
268
     * {@inheritdoc}
269
     */
270
    public function dropIndexByName($tableName, $indexName)
271
    {
272
        $adapter = $this->getAdapter();
273
        if (!$adapter instanceof DirectActionInterface) {
274
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
275
        }
276
        $adapterTableName = $this->getAdapterTableName($tableName);
277
        $adapter->dropIndexByName($adapterTableName, $indexName);
278
    }
279
280
    /**
281
     * {@inheritdoc}
@@ 317-325 (lines=9) @@
314
    /**
315
     * {@inheritdoc}
316
     */
317
    public function dropForeignKey($tableName, $columns, $constraint = null)
318
    {
319
        $adapter = $this->getAdapter();
320
        if (!$adapter instanceof DirectActionInterface) {
321
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
322
        }
323
        $adapterTableName = $this->getAdapterTableName($tableName);
324
        $adapter->dropForeignKey($adapterTableName, $columns, $constraint);
325
    }
326
327
    /**
328
     * {@inheritdoc}

src/Phinx/Db/Adapter/TimedOutputAdapter.php 1 location

@@ 182-192 (lines=11) @@
179
    /**
180
     * {@inheritdoc}
181
     */
182
    public function dropTable($tableName)
183
    {
184
        $adapter = $this->getAdapter();
185
        if (!$adapter instanceof DirectActionInterface) {
186
            throw new \BadMethodCallException('The adapter needs to implement DirectActionInterface');
187
        }
188
        $end = $this->startCommandTimer();
189
        $this->writeCommand('dropTable', [$tableName]);
190
        $adapter->dropTable($tableName);
191
        $end();
192
    }
193
194
    /**
195
     * {@inheritdoc}