| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 43 | public function validate($validator) |
||
| 44 | { |
||
| 45 | // get the previous values (could contain comma-delimited list) |
||
| 46 | |||
| 47 | $previous = $value = $this->Value(); |
||
| 48 | |||
| 49 | if (strstr($value, ",")) { |
||
| 50 | $value = explode(",", $value); |
||
| 51 | } |
||
| 52 | |||
| 53 | // set the value as an array for parent validation |
||
| 54 | |||
| 55 | $this->setValue($value); |
||
| 56 | |||
| 57 | $validated = parent::validate($validator); |
||
| 58 | |||
| 59 | // restore previous value after validation |
||
| 60 | |||
| 61 | $this->setValue($previous); |
||
| 62 | |||
| 63 | return $validated; |
||
| 64 | } |
||
| 65 | } |
||
| 66 |
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.