| Conditions | 5 |
| Paths | 8 |
| Total Lines | 17 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | public function php($data) { |
||
| 11 | $customValid = true; |
||
| 12 | $requiredValid = parent::php($data); |
||
| 13 | // If there's a custom validator set, validate with that too |
||
| 14 | if($validatorClass = self::config()->custom_validator) { |
||
| 15 | $custom = new $validatorClass(); |
||
| 16 | $custom->setForm($this->form); |
||
| 17 | $customValid = $custom->php($data); |
||
| 18 | if(!$customValid) { |
||
| 19 | if($requiredValid) { |
||
| 20 | $this->errors = array(); |
||
| 21 | } |
||
| 22 | $this->errors = array_merge($this->errors, $custom->errors); |
||
| 23 | } |
||
| 24 | } |
||
| 25 | return $customValid && $requiredValid; |
||
| 26 | } |
||
| 27 | |||
| 29 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.