| Conditions | 5 |
| Paths | 8 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function __construct(array $drivers) |
||
| 21 | { |
||
| 22 | foreach($drivers as $driver) { |
||
| 23 | try{ |
||
| 24 | if(is_callable($driver)) { |
||
| 25 | $this->addDriver($driver()); |
||
| 26 | |||
| 27 | } else if(class_exists($driver)) { |
||
| 28 | $this->addDriver(new $driver()); |
||
| 29 | |||
| 30 | } else { |
||
| 31 | throw new Exception("Driver $driver cannot be initialized."); |
||
| 32 | } |
||
| 33 | } catch (Exception $driverException) { |
||
| 34 | $this->exceptions[] = $driverException; |
||
| 35 | } |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 59 |