Code Duplication    Length = 18-19 lines in 3 locations

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

@@ 1127-1144 (lines=18) @@
1124
     * {@inheritDoc}
1125
     *
1126
     */
1127
    public function getDecoratedConnection()
1128
    {
1129
        $options = $this->getOptions();
1130
        $options = [
1131
            'username' => $options['user'],
1132
            'password' => $options['pass'],
1133
            'database' => $options['name']
1134
        ] + $options;
1135
1136
        $driver = new MysqlDriver($options);
1137
        if (method_exists($driver, 'setConnection')) {
1138
            $driver->setConnection($this->connection);
1139
        } else {
1140
            $driver->connection($this->connection);
1141
        }
1142
1143
        return new Connection(['driver' => $driver] + $options);
1144
    }
1145
}
1146

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

@@ 1273-1291 (lines=19) @@
1270
     * {@inheritDoc}
1271
     *
1272
     */
1273
    public function getDecoratedConnection()
1274
    {
1275
        $options = $this->getOptions();
1276
        $options = [
1277
            'username' => $options['user'],
1278
            'password' => $options['pass'],
1279
            'database' => $options['name']
1280
        ] + $options;
1281
1282
        $driver = new PostgresDriver($options);
1283
1284
        if (method_exists($driver, 'setConnection')) {
1285
            $driver->setConnection($this->connection);
1286
        } else {
1287
            $driver->connection($this->connection);
1288
        }
1289
1290
        return new Connection(['driver' => $driver] + $options);
1291
    }
1292
}
1293

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

@@ 1150-1168 (lines=19) @@
1147
     * {@inheritDoc}
1148
     *
1149
     */
1150
    public function getDecoratedConnection()
1151
    {
1152
        $options = $this->getOptions();
1153
        $options = [
1154
            'username' => $options['user'],
1155
            'password' => $options['pass'],
1156
            'database' => $options['name']
1157
        ] + $options;
1158
1159
        $driver = new SqlServerDriver($options);
1160
1161
        if (method_exists($driver, 'setConnection')) {
1162
            $driver->setConnection($this->connection);
1163
        } else {
1164
            $driver->connection($this->connection);
1165
        }
1166
1167
        return new Connection(['driver' => $driver] + $options);
1168
    }
1169
}
1170