| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 10 | public function validate(mixed $value, object $rule, ?ValidationContext $context = null): Result |
|
| 18 | { |
||
| 19 | 10 | if (!$rule instanceof Json) { |
|
| 20 | 1 | throw new UnexpectedRuleException(Json::class, $rule); |
|
| 21 | } |
||
| 22 | |||
| 23 | 9 | $result = new Result(); |
|
| 24 | |||
| 25 | 9 | if (!$this->isValidJson($value)) { |
|
| 26 | 6 | $result->addError($rule->message); |
|
| 27 | } |
||
| 28 | |||
| 29 | 9 | return $result; |
|
| 30 | } |
||
| 54 |