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

@@ 923-943 (lines=21) @@
920
     * @param string $tableName Table Name
921
     * @return string
922
     */
923
    protected function getIndexSqlDefinition(Index $index, $tableName)
924
    {
925
        if (is_string($index->getName())) {
926
            $indexName = $index->getName();
927
        } else {
928
            $columnNames = $index->getColumns();
929
            if (is_string($columnNames)) {
930
                $columnNames = [$columnNames];
931
            }
932
            $indexName = sprintf('%s_%s', $tableName, implode('_', $columnNames));
933
        }
934
        $def = sprintf(
935
            "CREATE %s INDEX %s ON %s (%s)",
936
            ($index->getType() === Index::UNIQUE ? 'UNIQUE' : ''),
937
            $indexName,
938
            $this->quoteTableName($tableName),
939
            '"' . implode('","', $index->getColumns()) . '"'
940
        );
941
942
        return $def;
943
    }
944
945
    /**
946
     * Gets the Oracle Foreign Key Definition for an ForeignKey object.