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

@@ 953-976 (lines=24) @@
950
    /**
951
     * {@inheritDoc}
952
     */
953
    public function getDropIndexSQL($index, $table=null)
954
    {
955
        if ($index instanceof Index) {
956
            $indexName = $index->getQuotedName($this);
957
        } elseif (is_string($index)) {
958
            $indexName = $index;
959
        } else {
960
            throw new \InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
961
        }
962
963
        if ($table instanceof Table) {
964
            $table = $table->getQuotedName($this);
965
        } elseif (!is_string($table)) {
966
            throw new \InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
967
        }
968
969
        if ($index instanceof Index && $index->isPrimary()) {
970
            // mysql primary keys are always named "PRIMARY",
971
            // so we cannot use them in statements because of them being keyword.
972
            return $this->getDropPrimaryKeySQL($table);
973
        }
974
975
        return 'DROP INDEX ' . $indexName . ' ON ' . $table;
976
    }
977
978
    /**
979
     * @param string $table