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

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