Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | public static function make($name, $parameters, $httpClient = null) |
||
36 | { |
||
37 | if (!$name) { |
||
38 | throw new MissingConfigurationException('The config file is missing the (Default Driver Name)'); |
||
39 | } |
||
40 | |||
41 | // prepare the full driver class name |
||
42 | $driver_class = self::DRIVERS_NAMESPACE.ucwords($name); |
||
43 | |||
44 | if (!class_exists($driver_class)) { |
||
45 | throw new UnsupportedDriverException("The driver ($name) is not supported."); |
||
46 | } |
||
47 | |||
48 | // initialize the driver object and pass the parameters to it's constructor |
||
49 | $driver_object = new $driver_class($parameters, $httpClient); |
||
50 | |||
51 | return $driver_object; |
||
52 | } |
||
53 | } |
||
54 |