SettingValueChooser::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Galileo\SettingBundle\Lib\Model\ValueObject;
4
5
use Galileo\SettingBundle\Lib\Model\Setting;
6
7
class SettingValueChooser
0 ignored issues
show
Coding Style introduced by
Since you have declared the constructor as private, maybe you should also declare the class as final.
Loading history...
8
{
9
    private $value;
10
11 6
    public static function choose(Setting $setting = null, $default = null)
12
    {
13 6
        return new SettingValueChooser($setting, $default);
14
    }
15
16 6
    private function __construct(Setting $setting = null, $default = null)
17
    {
18 6
        $this->value = $setting ? $setting->value() : $default;
19 6
    }
20
21 6
    public function value()
22
    {
23 6
        return $this->value;
24
    }
25
}
26