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