Email::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
rs 9.6666
cc 1
eloc 7
nc 1
nop 3
1
<?php
2
3
namespace Shrikeh\PagerDuty\Entity\ContactMethod\Resource;
4
5
use Shrikeh\PagerDuty\Entity\ContactMethod\Resource;
6
use Shrikeh\PagerDuty\Entity\ContactMethod\Resource\Type;
7
8
final class Email implements Resource
9
{
10
    use Type;
11
12
    private $emailAddress;
13
    private $sendShortEmail;
14
    private $sendHtmlEmail;
15
16
    public function __construct(
17
        $emailAddress,
18
        $sendShortEmail,
19
        $sendHtmlEmail
20
    ) {
21
        $this->emailAddress = $emailAddress;
22
        $this->sendShortEmail = (bool) $sendShortEmail;
23
        $this->sendHtmlEmail = (bool) $sendHtmlEmail;
24
    }
25
26
    public function __toString()
27
    {
28
        return $this->email();
29
    }
30
31
    public function email()
32
    {
33
        return $this->emailAddress;
34
    }
35
36
    public function sendShortMail()
37
    {
38
        return $this->sendShortEmail;
39
    }
40
41
    public function sendHtmlEmail()
42
    {
43
        return $this->sendHtmlEmail;
44
    }
45
}
46