| Conditions | 6 |
| Paths | 6 |
| Total Lines | 32 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 2 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 18 | public function create(array $config) |
||
| 19 | { |
||
| 20 | if (!isset($config["driver"])) { |
||
| 21 | throw new InvalidArgumentException("Undefined driver"); |
||
| 22 | } |
||
| 23 | |||
| 24 | if ($config["driver"] === "mssql") { |
||
| 25 | return new AuraBuilder( |
||
| 26 | new QueryFactory("sqlsrv") |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | |||
| 30 | if ($config["driver"] === "mysql") { |
||
| 31 | return new AuraBuilder( |
||
| 32 | new QueryFactory("mysql") |
||
| 33 | ); |
||
| 34 | } |
||
| 35 | |||
| 36 | if ($config["driver"] === "postgresql") { |
||
| 37 | return new AuraBuilder( |
||
| 38 | new QueryFactory("pgsql") |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 42 | if ($config["driver"] === "sqlite") { |
||
| 43 | return new AuraBuilder( |
||
| 44 | new QueryFactory("sqlite") |
||
| 45 | ); |
||
| 46 | } |
||
| 47 | |||
| 48 | throw new InvalidArgumentException("Unrecognised driver"); |
||
| 49 | } |
||
| 50 | } |
||
| 51 |