| Conditions | 6 |
| Paths | 10 |
| Total Lines | 24 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 18 | public function createDatabaseSourceString($config) |
||
| 19 | { |
||
| 20 | $driver = $config['DRIVER']; |
||
| 21 | |||
| 22 | switch ($driver) { |
||
| 23 | case 'sqlite': |
||
| 24 | $dsn = $driver.'::memory:'; |
||
| 25 | break; |
||
| 26 | case 'mysql': |
||
| 27 | case 'postgres': |
||
| 28 | if (strcasecmp($driver, 'postgres') == 0) { |
||
| 29 | $driver = 'pgsql'; |
||
| 30 | } |
||
| 31 | $dsn = $driver.':host='.$config['HOSTNAME'].';dbname='.$config['DBNAME']; |
||
| 32 | if (isset($config['PORT'])) { |
||
| 33 | $dsn .= ';port='.$config['PORT']; |
||
| 34 | } |
||
| 35 | break; |
||
| 36 | default: |
||
| 37 | throw new DatabaseDriverNotSupportedException(); |
||
| 38 | } |
||
| 39 | |||
| 40 | return $dsn; |
||
| 41 | } |
||
| 42 | } |
||
| 43 |