| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 16 | public function create(array $config) |
||
| 17 | { |
||
| 18 | if (!isset($config["driver"])) { |
||
| 19 | throw new InvalidArgumentException("Undefined driver"); |
||
| 20 | } |
||
| 21 | |||
| 22 | $connectors = new ConnectorFactory(); |
||
| 23 | $builders = new BuilderFactory(); |
||
| 24 | |||
| 25 | if ($config["driver"] === "mysql") { |
||
| 26 | return new Manager( |
||
| 27 | $connectors->create($config), |
||
| 28 | $builders->create($config) |
||
| 29 | ); |
||
| 30 | } |
||
| 31 | |||
| 32 | throw new InvalidArgumentException("Unrecognised driver"); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |