These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace PhpGitHooks\Module\Configuration\Domain; |
||
4 | |||
5 | use PhpGitHooks\Module\Configuration\Model\ToolInterface; |
||
6 | |||
7 | View Code Duplication | class Composer implements ToolInterface |
|
0 ignored issues
–
show
|
|||
8 | { |
||
9 | /** |
||
10 | * @var Enabled |
||
11 | */ |
||
12 | private $enabled; |
||
13 | /** |
||
14 | * @var Undefined |
||
15 | */ |
||
16 | private $undefined; |
||
17 | |||
18 | /** |
||
19 | * Composer constructor. |
||
20 | * |
||
21 | * @param Undefined $undefined |
||
22 | * @param Enabled $enabled |
||
23 | */ |
||
24 | 6 | public function __construct(Undefined $undefined, Enabled $enabled) |
|
25 | { |
||
26 | 6 | $this->enabled = $enabled; |
|
27 | 6 | $this->undefined = $undefined; |
|
28 | 6 | } |
|
29 | |||
30 | /** |
||
31 | * @return bool |
||
32 | */ |
||
33 | 4 | public function isEnabled() |
|
34 | { |
||
35 | 4 | return $this->enabled->value(); |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * @return bool |
||
40 | */ |
||
41 | 3 | public function isUndefined() |
|
42 | { |
||
43 | 3 | return $this->undefined->value(); |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * @param Enabled $enabled |
||
48 | * |
||
49 | * @return Composer |
||
50 | */ |
||
51 | 2 | public function setEnabled(Enabled $enabled) |
|
52 | { |
||
53 | 2 | return new self( |
|
54 | 2 | new Undefined(false), |
|
55 | 2 | $enabled |
|
56 | ); |
||
57 | } |
||
58 | } |
||
59 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.