Completed
Push — master ( e45dbf...3a73d5 )
by Nate
05:43 queued 04:08
created

EnvironmentRules::environmentRules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 0
cts 27
cp 0
rs 9.488
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/patron/license
6
 * @link       https://www.flipboxfactory.com/software/patron/
7
 */
8
9
namespace flipbox\patron\records\traits;
10
11
use flipbox\ember\helpers\ModelHelper;
12
use flipbox\patron\Patron;
13
14
/**
15
 * @property string|null $environment
16
 *
17
 * @author Flipbox Factory <[email protected]>
18
 * @since 1.0.0
19
 */
20
trait EnvironmentRules
21
{
22
    /**
23
     * @inheritdoc
24
     */
25
    protected function environmentRules()
26
    {
27
        return [
28
            [
29
                [
30
                    'environment'
31
                ],
32
                'required'
33
            ],
34
            [
35
                [
36
                    'environment'
37
                ],
38
                'default',
39
                'value' => Patron::getInstance()->getSettings()->getEnvironment()
40
            ],
41
            [
42
                [
43
                    'environment'
44
                ],
45
                'safe',
46
                'on' => [
47
                    ModelHelper::SCENARIO_DEFAULT
48
                ]
49
            ]
50
        ];
51
    }
52
}
53