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

FieldRules   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 28
ccs 0
cts 22
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fieldRules() 0 22 1
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