Code Duplication    Length = 24-24 lines in 2 locations

lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php 1 location

@@ 420-443 (lines=24) @@
417
    /**
418
     * {@inheritDoc}
419
     */
420
    public function getDropIndexSQL($index, $table=null)
421
    {
422
        if ($index instanceof Index) {
423
            $indexName = $index->getQuotedName($this);
424
        } elseif (is_string($index)) {
425
            $indexName = $index;
426
        } else {
427
            throw new \InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
428
        }
429
430
        if ($table instanceof Table) {
431
            $table = $table->getQuotedName($this);
432
        } elseif (!is_string($table)) {
433
            throw new \InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
434
        }
435
436
        if ($index instanceof Index && $index->isPrimary()) {
437
            // drizzle primary keys are always named "PRIMARY",
438
            // so we cannot use them in statements because of them being keyword.
439
            return $this->getDropPrimaryKeySQL($table);
440
        }
441
442
        return 'DROP INDEX ' . $indexName . ' ON ' . $table;
443
    }
444
445
    /**
446
     * {@inheritDoc}

lib/Doctrine/DBAL/Platforms/MySqlPlatform.php 1 location

@@ 967-990 (lines=24) @@
964
    /**
965
     * {@inheritDoc}
966
     */
967
    public function getDropIndexSQL($index, $table=null)
968
    {
969
        if ($index instanceof Index) {
970
            $indexName = $index->getQuotedName($this);
971
        } elseif (is_string($index)) {
972
            $indexName = $index;
973
        } else {
974
            throw new \InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
975
        }
976
977
        if ($table instanceof Table) {
978
            $table = $table->getQuotedName($this);
979
        } elseif (!is_string($table)) {
980
            throw new \InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
981
        }
982
983
        if ($index instanceof Index && $index->isPrimary()) {
984
            // mysql primary keys are always named "PRIMARY",
985
            // so we cannot use them in statements because of them being keyword.
986
            return $this->getDropPrimaryKeySQL($table);
987
        }
988
989
        return 'DROP INDEX ' . $indexName . ' ON ' . $table;
990
    }
991
992
    /**
993
     * @param string $table