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

SafeValidator::validateAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 2
dl 0
loc 2
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
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