| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4.016 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 3 | public function assert($data) |
|
| 25 | { |
||
| 26 | 3 | if (is_string($this->rule)) { |
|
| 27 | 1 | if (!$this->tester->parse($this->rule)->test($data)) { |
|
| 28 | 1 | throw new InvalidValueException([$this->rule]); |
|
| 29 | } |
||
| 30 | return; |
||
| 31 | } |
||
| 32 | |||
| 33 | 2 | $errorBag = new ErrorBag(); |
|
| 34 | 2 | $this->rule->define(new AssertRuleDefinition($this->tester, $errorBag, $data, $data)); |
|
| 35 | 2 | if (count($errorBag)) { |
|
| 36 | 2 | throw new InvalidValueException($errorBag->errors()); |
|
| 37 | } |
||
| 38 | 2 | } |
|
| 39 | |||
| 56 |