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

Property::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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