Code Duplication    Length = 5-5 lines in 3 locations

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

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

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

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