Conditions | 3 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | public function validate($validator) |
||
34 | { |
||
35 | // get the previous values (could contain comma-delimited list) |
||
36 | |||
37 | $previous = $value = $this->Value(); |
||
38 | |||
39 | if (is_string($value) && strstr($value, ",")) { |
||
40 | $value = explode(",", $value); |
||
41 | } |
||
42 | |||
43 | // set the value as an array for parent validation |
||
44 | |||
45 | $this->setValue($value); |
||
46 | |||
47 | $validated = parent::validate($validator); |
||
48 | |||
49 | // restore previous value after validation |
||
50 | |||
51 | $this->setValue($previous); |
||
52 | |||
53 | return $validated; |
||
54 | } |
||
55 | } |
||
56 |
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.