IdRulesTrait::idRules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 0
cts 21
cp 0
rs 9.584
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipboxfactory/craft-ember/blob/master/LICENSE
6
 * @link       https://github.com/flipboxfactory/craft-ember/
7
 */
8
9
namespace flipbox\craft\ember\models;
10
11
use yii\base\Model;
12
13
/**
14
 * @property int|null $id
15
 *
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 2.0.0
18
 */
19
trait IdRulesTrait
20
{
21
    /**
22
     * @inheritdoc
23
     */
24
    protected function idRules()
25
    {
26
        return [
27
            [
28
                [
29
                    'id'
30
                ],
31
                'number',
32
                'integerOnly' => true
33
            ],
34
            [
35
                [
36
                    'id'
37
                ],
38
                'safe',
39
                'on' => [
40
                    Model::SCENARIO_DEFAULT
41
                ]
42
            ]
43
        ];
44
    }
45
}
46