| Conditions | 3 |
| Paths | 3 |
| Total Lines | 24 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3.0052 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | 1 | public function load($path) |
|
| 12 | { |
||
| 13 | 1 | $this->setSourceName($path); |
|
| 14 | |||
| 15 | // We silently skip any nonexistent config files, so that |
||
| 16 | // clients may simply `load` all of their candidates. |
||
| 17 | 1 | if (!file_exists($path)) { |
|
| 18 | 1 | $this->config = []; |
|
| 19 | |||
| 20 | 1 | return $this; |
|
| 21 | } |
||
| 22 | |||
| 23 | 1 | $content = file_get_contents($path); |
|
| 24 | |||
| 25 | 1 | if (false === $content) { |
|
| 26 | return $this; |
||
| 27 | } |
||
| 28 | |||
| 29 | 1 | $this->config = (array) json_decode( |
|
| 30 | 1 | $content, |
|
| 31 | 1 | true |
|
| 32 | ); |
||
| 33 | |||
| 34 | 1 | return $this; |
|
| 35 | } |
||
| 37 |