Code Duplication    Length = 5-5 lines in 3 locations

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

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

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

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