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

Parts   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 49
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 9 1
A getDisplayName() 0 4 1
A getDomain() 0 4 1
A getLocalPart() 0 4 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