| Conditions | 4 |
| Paths | 3 |
| Total Lines | 8 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 7 | public function validate(IValidate $entry): void |
|
| 18 | { |
||
| 19 | 7 | if (!(is_string($entry->getValue()) || is_numeric($entry->getValue()))) { |
|
| 20 | 2 | throw new RuleException($this->errorText); |
|
| 21 | } |
||
| 22 | 5 | json_decode(strval($entry->getValue())); |
|
| 23 | 5 | if (JSON_ERROR_NONE !== json_last_error()) { |
|
| 24 | 2 | throw new RuleException($this->errorText, 0, new RuleException(json_last_error_msg())); |
|
| 25 | } |
||
| 28 |