| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | 4 | public function load() |
|
| 39 | { |
||
| 40 | 4 | $content = json_decode(file_get_contents($this->entity), true); |
|
| 41 | |||
| 42 | 4 | if (json_last_error() !== JSON_ERROR_NONE) { |
|
| 43 | 1 | $message = function_exists('json_last_error_msg') ? json_last_error_msg() : 'Parse error'; |
|
| 44 | |||
| 45 | 1 | throw new \RuntimeException( |
|
| 46 | 1 | sprintf("'%s' failed to load with the error '%s'", $this->entity, $message) |
|
| 47 | ); |
||
| 48 | } |
||
| 49 | |||
| 50 | 3 | $this->content = $content; |
|
| 51 | 3 | return $this; |
|
| 52 | } |
||
| 53 | } |
||
| 54 |