Total Complexity | 3 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 80% |
Changes | 0 |
1 | <?php |
||
19 | class DefaultValueValidator extends Validator |
||
20 | { |
||
21 | /** |
||
22 | * @var mixed the default value or an anonymous function that returns the default value which will |
||
23 | * be assigned to the attributes being validated if they are empty. The signature of the anonymous function |
||
24 | * should be as follows, |
||
25 | * |
||
26 | * ```php |
||
27 | * function($model, $attribute) { |
||
28 | * // compute value |
||
29 | * return $value; |
||
30 | * } |
||
31 | * ``` |
||
32 | */ |
||
33 | public $value; |
||
34 | /** |
||
35 | * @var bool this property is overwritten to be false so that this validator will |
||
36 | * be applied when the value being validated is empty. |
||
37 | */ |
||
38 | public $skipOnEmpty = false; |
||
39 | |||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | 2 | public function validateAttribute($model, $attribute) |
|
55 |