Completed
Push — master ( 2b60fb...0f5433 )
by David
02:06
created

Parts::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
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
3
declare(strict_types=1);
4
5
/*
6
 * Copyright (C) 2013 Mailgun
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license. See the LICENSE file for details.
10
 */
11
12
namespace Mailgun\Model\EmailValidation;
13
14
/**
15
 * @author David Garcia <[email protected]>
16
 */
17
final class Parts
18
{
19
    /**
20
     * @var string|null
21
     */
22
    private $displayName;
23
24
    /**
25
     * @var string|null
26
     */
27
    private $domain;
28
29
    /**
30
     * @var string|null
31
     */
32
    private $localPart;
33
34 4
    private function __construct()
35
    {
36 4
    }
37
38
    /**
39
     * @return Parts
40
     */
41 4
    public static function create(array $data)
42
    {
43 4
        $model = new self();
44 4
        $model->displayName = $data['display_name'] ?? null;
45 4
        $model->domain = $data['domain'] ?? null;
46 4
        $model->localPart = $data['local_part'] ?? null;
47
48 4
        return $model;
49
    }
50
51 1
    public function getDisplayName(): ?string
52
    {
53 1
        return $this->displayName;
54
    }
55
56 1
    public function getDomain(): ?string
57
    {
58 1
        return $this->domain;
59
    }
60
61 1
    public function getLocalPart(): ?string
62
    {
63 1
        return $this->localPart;
64
    }
65
}
66