Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
42 | public function isValid(AnnotatedInterface $model, $attribute) |
||
43 | { |
||
44 | $label = ManganMeta::create($model)->field($attribute)->label; |
||
45 | if (!is_array($model->$attribute)) |
||
46 | { |
||
47 | if (!$model->$attribute instanceof Countable) |
||
48 | { |
||
49 | $this->addError('msgInvalid', ['{attribute}' => $label]); |
||
50 | return false; |
||
51 | } |
||
52 | } |
||
53 | $value = count($model->$attribute); |
||
54 | return $this->isValidValueOf($model, $attribute, $value, $label); |
||
55 | } |
||
56 | |||
58 |