SettingValue::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 10
ccs 5
cts 5
cp 1
crap 1
rs 10
1
<?php
2
3
/**
4
 * Settings Manager
5
 *
6
 * @license http://opensource.org/licenses/MIT
7
 * @link https://github.com/caseyamcl/settings-manager
8
 * @package caseyamcl/settings-manager
9
 * @author Casey McLaughlin <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 *
14
 *  ------------------------------------------------------------------
15
 */
16
17
declare(strict_types=1);
18
19
namespace SettingsManager\Model;
20
21
use SettingsManager\Contract\SettingProvider;
22
23
/**
24
 * Setting value - Stores a value for a given setting
25
 *
26
 * @author Casey McLaughlin <[email protected]>
27
 */
28
class SettingValue
29
{
30
    /**
31
     * @var string
32
     */
33
    private $providerName;
34
35
    /**
36
     * @var bool
37
     */
38
    private $isMutable;
39
40
    /**
41
     * @var mixed
42
     */
43
    private $value;
44
45
    /**
46
     * @var string
47
     */
48
    private $settingName;
49
50
    /**
51
     * SettingValue constructor.
52
     * @param string $settingName
53
     * @param SettingProvider $provider
54
     * @param bool $isMutable
55
     * @param mixed $value
56
     */
57 108
    public function __construct(
58
        string $settingName,
59
        SettingProvider $provider,
60
        bool $isMutable,
61
        $value
62
    ) {
63 108
        $this->providerName = $provider->getName();
64 108
        $this->isMutable = $isMutable;
65 108
        $this->value = $value;
66 108
        $this->settingName = $settingName;
67 108
    }
68
69
    /**
70
     * @return string
71
     */
72 60
    final public function getName(): string
73
    {
74 60
        return $this->settingName;
75
    }
76
77
    /**
78
     * @return string
79
     */
80 3
    final public function getProviderName(): string
81
    {
82 3
        return $this->providerName;
83
    }
84
85
    /**
86
     * @return bool
87
     */
88 33
    final public function isMutable(): bool
89
    {
90 33
        return $this->isMutable;
91
    }
92
93
    /**
94
     * @return mixed
95
     */
96 57
    final public function getValue()
97
    {
98 57
        return $this->value;
99
    }
100
}
101