| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 2 |
| 1 | <?php |
||
| 16 | public static function build($vendor, $path, LoggerInterface $logger = null) |
||
| 17 | { |
||
| 18 | if (!$configuration = parse_ini_file($path, true)) { |
||
| 19 | throw new \Exception("File '$path' is not a valid PHP configuration file"); |
||
| 20 | } |
||
| 21 | |||
| 22 | if (!in_array($vendor, array_keys($configuration))) { |
||
| 23 | throw new \Exception("Missing $vendor configuration"); |
||
| 24 | } |
||
| 25 | |||
| 26 | $class = sprintf('\Libcast\AssetDistributor\%1$s\%1$sConfiguration', $vendor); |
||
| 27 | if (!class_exists($class)) { |
||
| 28 | throw new \Exception("Missing configuration class for $vendor"); |
||
| 29 | } |
||
| 30 | |||
| 31 | return new $class($configuration[$vendor], $logger); |
||
| 32 | } |
||
| 33 | |||
| 49 |