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

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