Passed
Push — master ( 98de4f...224db0 )
by Thiago
30s
created

Email::getPrimary()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

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
nc 1
nop 0
crap 1
1
<?php
2
namespace MrPrompt\ShipmentCommon\Base;
3
4
/**
5
 * E-mail
6
 *
7
 * @author Thiago Paes <[email protected]>
8
 */
9
class Email
10
{
11
    /**
12
     * @var string
13
     */
14
    private $address;
15
16
    /**
17
     * @var boolean
18
     */
19
    private $primary;
20
21
    /**
22
     * @param string $address
23
     * @param bool $primary
24
     */
25 5
    public function __construct(string $address = null, bool $primary = true)
26
    {
27 5
        $this->setAddress($address);
28 5
        $this->setPrimary($primary);
29 5
    }
30
31
    /**
32
     * @return string
33
     */
34 1
    public function getAddress(): string
35
    {
36 1
        return $this->address;
37
    }
38
39
    /**
40
     * @param string $address
41
     */
42 1
    public function setAddress(string $address)
43
    {
44 1
        $this->address = $address;
45 1
    }
46
47
    /**
48
     * @return boolean
49
     */
50 1
    public function isPrimary(): bool
51
    {
52 1
        return $this->primary === true;
53
    }
54
55
    /**
56
     * @return boolean
57
     */
58 1
    public function getPrimary(): bool
59
    {
60 1
        return $this->primary;
61
    }
62
63
    /**
64
     * @param boolean $primary
65
     */
66 1
    public function setPrimary(bool $primary = true)
67
    {
68 1
        $this->primary = $primary;
69
    }
70
}