ContactMethod::isHidden()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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