Code Duplication    Length = 9-11 lines in 8 locations

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

@@ 103-111 (lines=9) @@
100
    /**
101
     * {@inheritdoc}
102
     */
103
    public function dropTable($tableName)
104
    {
105
        $adapter = $this->getAdapter();
106
        if (!$adapter instanceof DirectActionInterface) {
107
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
108
        }
109
        $adapterTableName = $this->getAdapterTableName($tableName);
110
        $adapter->dropTable($adapterTableName);
111
    }
112
113
    /**
114
     * {@inheritdoc}
@@ 159-167 (lines=9) @@
156
    /**
157
     * {@inheritdoc}
158
     */
159
    public function renameColumn($tableName, $columnName, $newColumnName)
160
    {
161
        $adapter = $this->getAdapter();
162
        if (!$adapter instanceof DirectActionInterface) {
163
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
164
        }
165
        $adapterTableName = $this->getAdapterTableName($tableName);
166
        $adapter->renameColumn($adapterTableName, $columnName, $newColumnName);
167
    }
168
169
    /**
170
     * {@inheritdoc}
@@ 172-180 (lines=9) @@
169
    /**
170
     * {@inheritdoc}
171
     */
172
    public function changeColumn($tableName, $columnName, Column $newColumn)
173
    {
174
        $adapter = $this->getAdapter();
175
        if (!$adapter instanceof DirectActionInterface) {
176
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
177
        }
178
        $adapterTableName = $this->getAdapterTableName($tableName);
179
        $adapter->changeColumn($adapterTableName, $columnName, $newColumn);
180
    }
181
182
    /**
183
     * {@inheritdoc}
@@ 185-193 (lines=9) @@
182
    /**
183
     * {@inheritdoc}
184
     */
185
    public function dropColumn($tableName, $columnName)
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->dropColumn($adapterTableName, $columnName);
193
    }
194
195
    /**
196
     * {@inheritdoc}
@@ 231-239 (lines=9) @@
228
    /**
229
     * {@inheritdoc}
230
     */
231
    public function dropIndex($tableName, $columns)
232
    {
233
        $adapter = $this->getAdapter();
234
        if (!$adapter instanceof DirectActionInterface) {
235
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
236
        }
237
        $adapterTableName = $this->getAdapterTableName($tableName);
238
        $adapter->dropIndex($adapterTableName, $columns);
239
    }
240
241
    /**
242
     * {@inheritdoc}
@@ 244-252 (lines=9) @@
241
    /**
242
     * {@inheritdoc}
243
     */
244
    public function dropIndexByName($tableName, $indexName)
245
    {
246
        $adapter = $this->getAdapter();
247
        if (!$adapter instanceof DirectActionInterface) {
248
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
249
        }
250
        $adapterTableName = $this->getAdapterTableName($tableName);
251
        $adapter->dropIndexByName($adapterTableName, $indexName);
252
    }
253
254
    /**
255
     * {@inheritdoc}
@@ 281-289 (lines=9) @@
278
    /**
279
     * {@inheritdoc}
280
     */
281
    public function dropForeignKey($tableName, $columns, $constraint = null)
282
    {
283
        $adapter = $this->getAdapter();
284
        if (!$adapter instanceof DirectActionInterface) {
285
            throw new \BadMethodCallException('The underlying adapter does not implement DirectActionInterface');
286
        }
287
        $adapterTableName = $this->getAdapterTableName($tableName);
288
        $adapter->dropForeignKey($adapterTableName, $columns, $constraint);
289
    }
290
291
    /**
292
     * {@inheritdoc}

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

@@ 160-170 (lines=11) @@
157
    /**
158
     * {@inheritdoc}
159
     */
160
    public function dropTable($tableName)
161
    {
162
        $adapter = $this->getAdapter();
163
        if (!$adapter instanceof DirectActionInterface) {
164
            throw new \BadMethodCallException('The adapter needs to implement DirectActionInterface');
165
        }
166
        $end = $this->startCommandTimer();
167
        $this->writeCommand('dropTable', [$tableName]);
168
        $adapter->dropTable($tableName);
169
        $end();
170
    }
171
172
    /**
173
     * {@inheritdoc}