Completed
Push — master ( 982f0c...377cb6 )
by Kamil
05:13 queued 02:16
created

SettingValueChooser   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A choose() 0 4 1
A __construct() 0 4 2
A value() 0 4 1
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
    public static function choose(Setting $setting = null, $default = null)
12
    {
13
        return new SettingValueChooser($setting, $default);
14
    }
15
16
    private function __construct(Setting $setting = null, $default = null)
17
    {
18
        $this->value = $setting ? $setting->value() : $default;
19
    }
20
21
    public function value()
22
    {
23
        return $this->value;
24
    }
25
}
26