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

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