Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
13 | 10 | public static function create($config) |
|
14 | { |
||
15 | 10 | if(!array_key_exists('driver', $config)) { |
|
16 | 1 | throw new InvalidArgumentException('You must specify a driver'); |
|
17 | } |
||
18 | |||
19 | 9 | switch ($config['driver']) { |
|
20 | 9 | case 'mysql': |
|
21 | 1 | return new Mysql($config); |
|
22 | 8 | case 'sqlite': |
|
23 | 7 | return new Sqlite($config); |
|
24 | 1 | default: |
|
25 | 1 | throw new InvalidArgumentException('Invalid or no driver specified'); |
|
26 | 1 | } |
|
27 | } |
||
28 | } |
||
29 |