Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
29 | 50 | public static function getDBHelper(string $driver) |
|
30 | { |
||
31 | $drivers = [ |
||
32 | 50 | '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 | 50 | if (!array_key_exists($driver, $drivers)) { |
|
46 | 2 | throw new \InvalidArgumentException("$driver unknown"); |
|
47 | } |
||
48 | |||
49 | 48 | return $drivers[$driver]; |
|
50 | } |
||
52 |