| Conditions | 3 |
| Paths | 5 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0175 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | 1 | public function get(string $key, $default = null) |
|
| 30 | { |
||
| 31 | try { |
||
| 32 | 1 | $contents = $this->filesystem->read($this->key($key)); |
|
| 33 | 1 | $json = json_decode($contents, true); |
|
| 34 | |||
| 35 | 1 | if (json_last_error() === JSON_ERROR_NONE) { |
|
| 36 | return $json; |
||
| 37 | } |
||
| 38 | |||
| 39 | 1 | return $contents; |
|
| 40 | 1 | } catch (FileNotFoundException $exception) { |
|
| 41 | 1 | return $default; |
|
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 80 |