Code Duplication    Length = 5-5 lines in 2 locations

src/database/PdoDatabase.class.php 2 locations

@@ 107-111 (lines=5) @@
104
105
            $options = array();
106
107
            if ($this->hasParameter('options')) {
108
                foreach ((array)$this->getParameter('options') as $key => $value) {
109
                    $options[is_string($key) && strpos($key, '::') ? constant($key) : $key] = is_string($value) && strpos($value, '::') ? constant($value) : $value;
110
                }
111
            }
112
113
            $this->connection = $this->resource = new \PDO($dsn, $username, $password, $options);
114
@@ 120-124 (lines=5) @@
117
                // lets generate exceptions instead of silent failures
118
                \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION
119
            );
120
            if ($this->hasParameter('attributes')) {
121
                foreach ((array)$this->getParameter('attributes') as $key => $value) {
122
                    $attributes[is_string($key) && strpos($key, '::') ? constant($key) : $key] = is_string($value) && strpos($value, '::') ? constant($value) : $value;
123
                }
124
            }
125
            foreach ($attributes as $key => $value) {
126
                $this->connection->setAttribute($key, $value);
127
            }