| Conditions | 5 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5.1502 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 2 | public function load($resource, $type = null) |
|
| 23 | { |
||
| 24 | 2 | if (!stream_is_local($resource)) { |
|
| 25 | throw new \Exception(sprintf('This is not a local file "%s".', $resource)); |
||
| 26 | } |
||
| 27 | 2 | if (!file_exists($resource)) { |
|
| 28 | throw new \Exception(sprintf('File "%s" not found.', $resource)); |
||
| 29 | } |
||
| 30 | |||
| 31 | 2 | $configValues = $this->loadResource($resource); |
|
| 32 | |||
| 33 | 2 | if (isset($configValues["imports"])) { |
|
| 34 | 2 | foreach ($configValues["imports"] as $file) { |
|
| 35 | 2 | $configValues = array_merge_recursive($configValues, $this->import($this->locator->locate($file))); |
|
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | 2 | unset($configValues["imports"]); |
|
| 40 | |||
| 41 | 2 | return $configValues; |
|
| 42 | } |
||
| 43 | |||
| 51 |