| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | 72 | public static function getDBHelper(string $driver): string |
|
| 34 | { |
||
| 35 | $drivers = [ |
||
| 36 | 72 | 'pdo_mysql' => MySQL::class, |
|
| 37 | 'mysql' => MySQL::class, |
||
| 38 | 'mysql2' => MySQL::class, |
||
| 39 | |||
| 40 | 'pdo_pgsql' => PostgreSQL::class, |
||
| 41 | 'pgsql' => PostgreSQL::class, |
||
| 42 | 'postgres' => PostgreSQL::class, |
||
| 43 | 'postgresql' => PostgreSQL::class, |
||
| 44 | |||
| 45 | 'pdo_sqlsrv' => SQLServer::class, |
||
| 46 | 'mssql' => SQLServer::class, |
||
| 47 | ]; |
||
| 48 | |||
| 49 | 72 | if (! array_key_exists($driver, $drivers)) { |
|
| 50 | 2 | throw new \InvalidArgumentException("${driver} unknown"); |
|
| 51 | } |
||
| 52 | |||
| 53 | 71 | return $drivers[$driver]; |
|
| 54 | } |
||
| 56 |