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