Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php /** MicroEmailValidator */ |
||
24 | public function validate(IFormModel $model) |
||
25 | { |
||
26 | foreach ($this->elements AS $element) { |
||
27 | if (!$model->checkAttributeExists($element)) { |
||
28 | $this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model); |
||
29 | |||
30 | return false; |
||
31 | } |
||
32 | if (!filter_var($model->$element, FILTER_VALIDATE_EMAIL)) { |
||
33 | $this->errors[] = 'Parameter '.$element.' is not a valid E-mail address'; |
||
34 | |||
35 | return false; |
||
36 | } |
||
37 | } |
||
38 | |||
39 | return true; |
||
40 | } |
||
41 | |||
51 |