Conditions | 2 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
15 | public function __construct($dns) |
||
16 | { |
||
17 | try { |
||
18 | $this->pdo = new \PDO($dns); |
||
19 | $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); |
||
20 | } catch (\Exception $e) { |
||
21 | // Rethrow to hide connection details, through the original |
||
22 | // exception to view all connection details. |
||
23 | // throw $e; |
||
24 | throw new \PDOException("Could not connect to database."); |
||
25 | } |
||
26 | } |
||
27 | |||
58 |