Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 1057-1077 (lines=21) @@
1054
     * @param \Phinx\Db\Table\Index $index Index
1055
     * @return string
1056
     */
1057
    protected function getIndexSqlDefinition(Index $index, $tableName)
1058
    {
1059
        if (is_string($index->getName())) {
1060
            $indexName = $index->getName();
1061
        } else {
1062
            $columnNames = $index->getColumns();
1063
            if (is_string($columnNames)) {
1064
                $columnNames = [$columnNames];
1065
            }
1066
            $indexName = sprintf('%s_%s', $tableName, implode('_', $columnNames));
1067
        }
1068
        $def = sprintf(
1069
            "CREATE %s INDEX %s ON %s (%s);",
1070
            ($index->getType() === Index::UNIQUE ? 'UNIQUE' : ''),
1071
            $indexName,
1072
            $this->quoteTableName($tableName),
1073
            '[' . implode('],[', $index->getColumns()) . ']'
1074
        );
1075
1076
        return $def;
1077
    }
1078
1079
    /**
1080
     * Gets the SqlServer Foreign Key Definition for an ForeignKey object.

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

@@ 938-958 (lines=21) @@
935
     * @param \Phinx\Db\Table\Index $index Index
936
     * @return string
937
     */
938
    protected function getIndexSqlDefinition(Index $index, $tableName)
939
    {
940
        if (is_string($index->getName())) {
941
            $indexName = $index->getName();
942
        } else {
943
            $columnNames = $index->getColumns();
944
            if (is_string($columnNames)) {
945
                $columnNames = [$columnNames];
946
            }
947
            $indexName = sprintf('%s_%s', $tableName, implode('_', $columnNames));
948
        }
949
        $def = sprintf(
950
            "CREATE %s INDEX %s ON %s (%s)",
951
            ($index->getType() === Index::UNIQUE ? 'UNIQUE' : ''),
952
            $indexName,
953
            $this->quoteTableName($tableName),
954
            '"' . implode('","', $index->getColumns()) . '"'
955
        );
956
957
        return $def;
958
    }
959
960
    /**
961
     * Gets the Oracle Foreign Key Definition for an ForeignKey object.