Code Duplication    Length = 21-21 lines in 2 locations

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

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

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.