Completed
Push — master ( 3fbd33...51cff9 )
by David
02:08
created

Domain   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 63
c 0
b 0
f 0
wmc 10
lcom 1
cbo 0
ccs 26
cts 26
cp 1
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 13 2
A __construct() 0 3 1
A getName() 0 4 1
A getSmtpUsername() 0 4 1
A getSmtpPassword() 0 4 1
A isWildcard() 0 4 1
A getSpamAction() 0 4 1
A getState() 0 4 1
A getCreatedAt() 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\Domain;
13
14
/**
15
 * Represents domain information in its simplest form.
16
 *
17
 * @author Sean Johnson <[email protected]>
18
 */
19
final class Domain
20
{
21
    private $createdAt;
22
    private $smtpLogin;
23
    private $name;
24
    private $smtpPassword;
25
    private $wildcard;
26
    private $spamAction;
27
    private $state;
28
29 6
    public static function create(array $data): self
30
    {
31 6
        $model = new self();
32 6
        $model->name = $data['name'] ?? null;
33 6
        $model->smtpLogin = $data['smtp_login'] ?? null;
34 6
        $model->smtpPassword = $data['smtp_password'] ?? null;
35 6
        $model->wildcard = $data['wildcard'] ?? null;
36 6
        $model->spamAction = $data['spam_action'] ?? null;
37 6
        $model->state = $data['state'] ?? null;
38 6
        $model->createdAt = isset($data['created_at']) ? new \DateTimeImmutable($data['created_at']) : null;
39
40 6
        return $model;
41
    }
42
43 6
    private function __construct()
44
    {
45 6
    }
46
47 2
    public function getName(): ?string
48
    {
49 2
        return $this->name;
50
    }
51
52 1
    public function getSmtpUsername(): ?string
53
    {
54 1
        return $this->smtpLogin;
55
    }
56
57 1
    public function getSmtpPassword(): ?string
58
    {
59 1
        return $this->smtpPassword;
60
    }
61
62 1
    public function isWildcard(): ?bool
63
    {
64 1
        return $this->wildcard;
65
    }
66
67 1
    public function getSpamAction(): ?string
68
    {
69 1
        return $this->spamAction;
70
    }
71
72 1
    public function getState(): ?string
73
    {
74 1
        return $this->state;
75
    }
76
77 1
    public function getCreatedAt(): \DateTimeImmutable
78
    {
79 1
        return $this->createdAt;
80
    }
81
}
82