StateMutatorTrait::isEnabled()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
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\objects;
10
11
/**
12
 * @property bool $enabled
13
 *
14
 * @author Flipbox Factory <[email protected]>
15
 * @since 2.0.0
16
 */
17
trait StateMutatorTrait
18
{
19
    /**
20
     * @inheritdoc
21
     */
22
    public function isEnabled()
23
    {
24
        return (bool)$this->enabled;
25
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30
    public function isDisabled()
31
    {
32
        return !$this->isEnabled();
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function toEnabled()
39
    {
40
        $this->enabled = true;
41
        return $this;
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47
    public function toDisabled()
48
    {
49
        $this->enabled = false;
50
        return $this;
51
    }
52
}
53