Code Duplication    Length = 9-9 lines in 2 locations

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

@@ 88-96 (lines=9) @@
85
        try {
86
            $db = new PDO($dsn, $username, $password, $options);
87
88
            foreach ($adapterOptions as $key => $option) {
89
                if (strpos($key, 'attr_') === 0) {
90
                    $pdoConstant = '\PDO::' . strtoupper($key);
91
                    if (!defined($pdoConstant)) {
92
                        throw new \UnexpectedValueException('Invalid PDO attribute: ' . $key . ' (' . $pdoConstant . ')');
93
                    }
94
                    $db->setAttribute(constant($pdoConstant), $option);
95
                }
96
            }
97
        } catch (PDOException $e) {
98
            throw new InvalidArgumentException(sprintf(
99
                'There was a problem connecting to the database: %s',

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

@@ 95-103 (lines=9) @@
92
93
            // support arbitrary \PDO::SQLSRV_ATTR_* driver options and pass them to PDO
94
            // http://php.net/manual/en/ref.pdo-sqlsrv.php#pdo-sqlsrv.constants
95
            foreach ($options as $key => $option) {
96
                if (strpos($key, 'sqlsrv_attr_') === 0) {
97
                    $pdoConstant = '\PDO::' . strtoupper($key);
98
                    if (!defined($pdoConstant)) {
99
                        throw new \UnexpectedValueException('Invalid PDO attribute: ' . $key . ' (' . $pdoConstant . ')');
100
                    }
101
                    $driverOptions[constant($pdoConstant)] = $option;
102
                }
103
            }
104
105
            $db = $this->createPdoConnection($dsn, $options['user'], $options['pass'], $driverOptions);
106