Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
6 | private function configurePDOMySQL($params, &$pdoDsn, &$pdoUsername, &$pdoPassword, &$pdoAttributes) |
||
7 | { |
||
8 | $defaultParams = [ |
||
9 | 'hostname' => null, |
||
10 | 'database' => null, |
||
11 | 'username' => null, |
||
12 | 'password' => null, |
||
13 | 'encoding' => null |
||
14 | ]; |
||
15 | |||
16 | $params = array_merge($defaultParams, $params); |
||
17 | |||
18 | $pdoDsn = 'mysql:host=' . $params['hostname'] . ';dbname=' . $params['database']; |
||
19 | $pdoUsername = $params['username']; |
||
20 | $pdoPassword = $params['password']; |
||
21 | if ($params['encoding'] != null) { |
||
22 | $pdoAttributes[\PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES " . $params['encoding']; |
||
23 | } |
||
25 | } |