| Conditions | 5 |
| Paths | 6 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 33 | 2 | public function assert($item) |
|
| 34 | { |
||
| 35 | 2 | if (!isset($item)) return; |
|
| 36 | try { |
||
| 37 | 2 | $this->next->assert($item); |
|
| 38 | 2 | } catch (InvalidValueException $exception) { |
|
| 39 | 2 | return; |
|
| 40 | } |
||
| 41 | 2 | $errorType = ValidatorAbstract::ERROR_TYPE; |
|
| 42 | 2 | if ($this->next instanceof ValidatorAbstract) { |
|
| 43 | 2 | $errorType = $this->next->getErrorType(); |
|
| 44 | } |
||
| 45 | 2 | $suffix = isset($this->name) ? '@' . $this->name : ''; |
|
| 46 | 2 | throw new InvalidValueException('not.' . $errorType . $suffix); |
|
| 47 | } |
||
| 48 | |||
| 58 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.