ContactMethod   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 65
ccs 15
cts 15
cp 1
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A isHidden() 0 4 1
A setHidden() 0 5 1
A getValue() 0 11 2
A setValue() 0 5 1
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
abstract class ContactMethod extends Entity
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 4
    public function isHidden()
38
    {
39 4
        return $this->hidden;
40
    }
41
42
    /**
43
     * Set Hidden
44
     *
45
     * @param boolean $hidden
46
     *
47
     * @return ContactMethod
48
     */
49 4
    public function setHidden($hidden)
50
    {
51 4
        $this->hidden = $hidden;
52 4
        return $this;
53
    }
54
55
    /**
56
     * Get Value
57
     *
58
     * @return string
59
     */
60 6
    public function getValue()
61
    {
62 6
        if (empty($this->value)) {
63 2
            $class_name = get_class($this);
64 2
            throw new LogicException(sprintf(
65 2
                self::ERROR_MISSING_ATTRIBUTE_FORMAT,
66
                $class_name::ATTRIBUTE
67 2
            ));
68
        }
69 4
        return $this->value;
70
    }
71
72
    /**
73
     * Set Value
74
     *
75
     * @param string $value
76
     *
77
     * @return ContactMethod
78
     */
79 4
    public function setValue($value)
80
    {
81 4
        $this->value = $value;
82 4
        return $this;
83
    }
84
}
85