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