Completed
Push — master ( ca4bd4...d89b8a )
by Mauro
03:26
created

ContactMethod   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 63
loc 63
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A isHidden() 4 4 1
A setHidden() 5 5 1
A getValue() 9 9 2
A setValue() 5 5 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/*
3
 * This file is part of the La Voz Feed Generator package.
4
 *
5
 * (c) Zephia <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Zephia\LaVozFeed\Entity;
12
use Zephia\LaVozFeed\Exception\LogicException;
13
14
/**
15
 * Class ContactMethod
16
 *
17
 * @package Zephia\LaVozFeed\Entity
18
 * @author  Mauro Moreno <[email protected]>
19
 */
20 View Code Duplication
abstract class ContactMethod extends Entity
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

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.

Loading history...
21
{
22
    /**
23
     * @var bool
24
     */
25
    private $hidden = false;
26
27
    /**
28
     * @var string
29
     */
30
    private $value = '';
31
32
    /**
33
     * Is Hidden
34
     *
35
     * @return boolean
36
     */
37
    public function isHidden()
38
    {
39
        return $this->hidden;
40
    }
41
42
    /**
43
     * Set Hidden
44
     *
45
     * @param boolean $hidden
46
     *
47
     * @return ContactMethod
48
     */
49
    public function setHidden($hidden)
50
    {
51
        $this->hidden = $hidden;
52
        return $this;
53
    }
54
55
    /**
56
     * Get Value
57
     *
58
     * @return string
59
     */
60
    public function getValue()
61
    {
62
        if (empty($this->value)) {
63
            throw new LogicException(
64
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, get_class($this)::ATTRIBUTE)
65
            );
66
        }
67
        return $this->value;
68
    }
69
70
    /**
71
     * Set Value
72
     *
73
     * @param string $value
74
     *
75
     * @return ContactMethod
76
     */
77
    public function setValue($value)
78
    {
79
        $this->value = $value;
80
        return $this;
81
    }
82
}
83