Code Duplication    Length = 5-5 lines in 3 locations

src/Phinx/Db/Adapter/SqlServerAdapter.php 2 locations

@@ 63-67 (lines=5) @@
60
            $options = $this->getOptions();
61
62
            // if port is specified use it, otherwise use the SqlServer default
63
            if (empty($options['port'])) {
64
                $dsn = 'sqlsrv:server=' . $options['host'] . ';database=' . $options['name'];
65
            } else {
66
                $dsn = 'sqlsrv:server=' . $options['host'] . ',' . $options['port'] . ';database=' . $options['name'];
67
            }
68
            $dsn .= ';MultipleActiveResultSets=false';
69
70
            $driverOptions = [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION];
@@ 116-120 (lines=5) @@
113
        $options = $this->getOptions();
114
115
        // if port is specified use it, otherwise use the SqlServer default
116
        if (empty($options['port'])) {
117
            $dsn = 'dblib:host=' . $options['host'] . ';dbname=' . $options['name'];
118
        } else {
119
            $dsn = 'dblib:host=' . $options['host'] . ':' . $options['port'] . ';dbname=' . $options['name'];
120
        }
121
122
        $driverOptions = [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION];
123

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

@@ 64-68 (lines=5) @@
61
            $options = $this->getOptions();
62
63
            // if port is specified use it, otherwise use the PostgreSQL default
64
            if (isset($options['port'])) {
65
                $dsn = 'pgsql:host=' . $options['host'] . ';port=' . $options['port'] . ';dbname=' . $options['name'];
66
            } else {
67
                $dsn = 'pgsql:host=' . $options['host'] . ';dbname=' . $options['name'];
68
            }
69
70
            try {
71
                $db = new \PDO($dsn, $options['user'], $options['pass'], [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]);