Conditions | 4 |
Paths | 6 |
Total Lines | 21 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | public function create($configurations = array()) |
||
34 | { |
||
35 | // get the default provider name |
||
36 | $provider = isset($configurations['default']) ? $configurations['default'] : null; |
||
37 | |||
38 | if (!$provider) { |
||
39 | throw new MissingConfigurationException('Missing Configurations: Default Provider'); |
||
40 | } |
||
41 | |||
42 | // prepare the full driver class name |
||
43 | $driver_class = self::DRIVERS_NAMESPACE.ucwords($provider).'Provider'; |
||
44 | |||
45 | if (!class_exists($driver_class)) { |
||
46 | throw new UnsupportedProviderException("CDN provider ($provider) is not supported"); |
||
47 | } |
||
48 | |||
49 | // initialize the driver object and initialize it with the configurations |
||
50 | $driver_object = App::make($driver_class)->init($configurations); |
||
51 | |||
52 | return $driver_object; |
||
53 | } |
||
54 | } |
||
55 |