| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 3 | public function __construct(array $config) |
|
| 27 | { |
||
| 28 | 3 | $config += $this->default; |
|
| 29 | 3 | $schema = file_get_contents(__DIR__ . '/../res/config-schema.json'); |
|
| 30 | 3 | $validator = new JsonSchema\Validator; |
|
| 31 | 3 | $validator->check((object)$config, json_decode($schema)); |
|
| 32 | |||
| 33 | 3 | if (! $validator->isValid()) { |
|
| 34 | 1 | throw new \InvalidArgumentException(var_export($validator->getErrors(), true)); |
|
| 35 | } |
||
| 36 | |||
| 37 | 2 | $this->config = $config; |
|
| 38 | 2 | } |
|
| 39 | |||
| 45 |