Email::hydrate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
namespace Shrikeh\PagerDuty\Hydrator\ContactMethod\Resource;
4
5
use stdClass;
6
use Shrikeh\PagerDuty\Hydrator;
7
use Shrikeh\PagerDuty\Entity\ContactMethod\Resource\Email as EmailEntity;
8
9
final class Email implements Hydrator
10
{
11
    public function supports($type)
12
    {
13
        return 'email_contact_method' === $type;
14
    }
15
16
    public function hydrate(stdClass $dto)
17
    {
18
        return new EmailEntity(
19
            $dto->address,
20
            $dto->send_short_email,
21
            $dto->send_html_email
22
        );
23
    }
24
}
25