Passed
Push — scrutinizer-migrate-to-new-eng... ( 58afd6 )
by Alexander
18:11
created

SafeValidator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 14
ccs 2
cts 3
cp 0.6667
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validateAttribute() 0 2 1
A validateAttributes() 0 2 1
1
<?php
2
/**
3
 * @link http://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license http://www.yiiframework.com/license/
6
 */
7
8
namespace yii\validators;
9
10
/**
11
 * SafeValidator serves as a dummy validator whose main purpose is to mark the attributes to be safe for massive assignment.
12
 *
13
 * This class is required because of the way in which Yii determines whether a property is safe for massive assignment, that is,
14
 * when a user submits form data to be loaded into a model directly from the POST data, is it ok for a property to be copied.
15
 * In many cases, this is required but because sometimes properties are internal and you do not want the POST data to be able to
16
 * override these internal values (especially things like database row ids), Yii assumes all values are unsafe for massive assignment
17
 * unless a validation rule exists for the property, which in most cases it will. Sometimes, however, an item is safe for massive assigment but
18
 * does not have a validation rule associated with it - for instance, due to no validation being performed, in which case, you use this class
19
 * as a validation rule for that property. Although it has no functionality, it allows Yii to determine that the property is safe to copy.
20
 *
21
 * > Note: [[when]] property is not supported by SafeValidator.
22
 *
23
 * @author Qiang Xue <[email protected]>
24
 * @since 2.0
25
 */
26
class SafeValidator extends Validator
27
{
28
    /**
29
     * {@inheritdoc}
30
     */
31 2
    public function validateAttributes($model, $attributes = null)
32
    {
33 2
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function validateAttribute($model, $attribute)
39
    {
40
    }
41
}
42