Feature   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A fromNameAndStatus() 0 5 1
A __construct() 0 5 1
A getName() 0 4 1
A isEnabled() 0 4 1
A setNewName() 0 4 1
A enable() 0 4 1
A disable() 0 4 1
1
<?php
2
3
namespace LaravelFeature\Domain\Model;
4
5
class Feature
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...
6
{
7
    private $name;
8
    private $isEnabled;
9
10 33
    public static function fromNameAndStatus($name, $isEnabled)
11
    {
12 33
        $feature = new self($name, (bool) $isEnabled);
13 33
        return $feature;
14
    }
15
16 33
    private function __construct($name, $isEnabled)
17
    {
18 33
        $this->name = $name;
19 33
        $this->isEnabled = $isEnabled;
20 33
    }
21
22
    /**
23
     * @return string
24
     */
25 18
    public function getName()
26
    {
27 18
        return $this->name;
28
    }
29
30
    /**
31
     * @return bool
32
     */
33 15
    public function isEnabled()
34
    {
35 15
        return $this->isEnabled;
36
    }
37
38 3
    public function setNewName($newName)
39
    {
40 3
        $this->name = $newName;
41 3
    }
42
43 3
    public function enable()
44
    {
45 3
        $this->isEnabled = true;
46 3
    }
47
48 3
    public function disable()
49
    {
50 3
        $this->isEnabled = false;
51 3
    }
52
}
53