Passed
Push — master ( 83a1d8...40412c )
by Alec
03:08
created

Property   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 10
c 2
b 0
f 0
dl 0
loc 48
ccs 14
cts 14
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A isDefault() 0 3 1
A getValue() 0 3 1
A __construct() 0 4 1
A isNotDefault() 0 3 1
A setValue() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Spinner\Settings;
4
5
class Property
6
{
7
    /** @var mixed */
8
    protected $value;
9
    /** @var bool */
10
    protected $isDefault;
11
12
    /**
13
     * SettingsValue constructor.
14
     * @param mixed $defaultValue
15
     */
16 46
    public function __construct($defaultValue = null)
17
    {
18 46
        $this->value = $defaultValue;
19 46
        $this->isDefault = true;
20 46
    }
21
22
    /**
23
     * @return mixed
24
     */
25 45
    public function getValue()
26
    {
27 45
        return $this->value;
28
    }
29
30
    /**
31
     * @param mixed $value
32
     */
33 44
    public function setValue($value): void
34
    {
35 44
        $this->value = $value;
36 44
        $this->isDefault = false;
37 44
    }
38
39
    /**
40
     * @return bool
41
     */
42 16
    public function isDefault(): bool
43
    {
44 16
        return $this->isDefault;
45
    }
46
47
    /**
48
     * @return bool
49
     */
50 18
    public function isNotDefault(): bool
51
    {
52 18
        return !$this->isDefault;
53
    }
54
}
55