| Conditions | 5 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php /** MicroBooleanValidator */ |
||
| 39 | public function validate(IFormModel $model) |
||
| 40 | { |
||
| 41 | foreach ($this->elements AS $element) { |
||
| 42 | if (!$model->checkAttributeExists($element)) { |
||
| 43 | $this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model); |
||
| 44 | |||
| 45 | return false; |
||
| 46 | } |
||
| 47 | $elementValue = $model->$element; |
||
| 48 | |||
| 49 | if (($elementValue !== $this->params['true']) && ($elementValue !== $this->params['false'])) { |
||
| 50 | $this->errors[] = $element.' error: required element is empty.'; |
||
| 51 | |||
| 52 | return false; |
||
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | return true; |
||
| 57 | } |
||
| 58 | |||
| 68 |