Completed
Push — develop ( 9af24d...90e507 )
by Nate
11:21
created

FieldRules::fieldRules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 0
cts 22
cp 0
rs 9.568
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://flipboxfactory.com/software/domains/license
6
 * @link       https://www.flipboxfactory.com/software/domains/
7
 */
8
9
namespace flipbox\domains\records\traits;
10
11
use craft\base\Field;
12
use craft\base\FieldInterface;
13
use flipbox\ember\helpers\ModelHelper;
14
15
/**
16
 * @property int|null $fieldId
17
 * @property Field|FieldInterface|null $field
18
 *
19
 * @author Flipbox Factory <[email protected]>
20
 * @since 1.0.0
21
 */
22
trait FieldRules
23
{
24
    /**
25
     * @return array
26
     */
27
    protected function fieldRules(): array
28
    {
29
        return [
30
            [
31
                [
32
                    'fieldId'
33
                ],
34
                'number',
35
                'integerOnly' => true
36
            ],
37
            [
38
                [
39
                    'fieldId',
40
                    'field'
41
                ],
42
                'safe',
43
                'on' => [
44
                    ModelHelper::SCENARIO_DEFAULT
45
                ]
46
            ]
47
        ];
48
    }
49
}
50