SettingValueChooser   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 19
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A value() 0 4 1
A choose() 0 4 1
A __construct() 0 4 2
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