| Conditions | 3 |
| Paths | 3 |
| Total Lines | 25 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3.054 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 6 | 22 | private function configurePDOSQLite($params, &$pdoDsn, &$pdoUsername, &$pdoPassword) |
|
| 7 | { |
||
| 8 | $defaultParams = [ |
||
| 9 | 22 | 'username' => null, |
|
| 10 | 'password' => null, |
||
| 11 | 'memory' => null, |
||
| 12 | 'file' => null, |
||
| 13 | ]; |
||
| 14 | |||
| 15 | 22 | $params = array_merge($defaultParams, $params); |
|
| 16 | |||
| 17 | 22 | $pdoDsn = 'sqlite'; |
|
| 18 | |||
| 19 | 22 | if ($params['memory']) { |
|
| 20 | $pdoDsn .= '::memory:'; |
||
| 21 | } else { |
||
| 22 | 22 | if ($params['file'] !== null) { |
|
| 23 | 22 | $pdoDsn .= ':' . $params['file']; |
|
| 24 | } else { |
||
| 25 | throw new \Exception("Missing SQLite file parameter"); |
||
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 29 | 22 | $pdoUsername = $params['username']; |
|
| 30 | 22 | $pdoPassword = $params['password']; |
|
| 31 | } |
||
| 32 | } |