Completed
Push — master ( 1fd018...1044a6 )
by David
20:21
created

Whitelist   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 42
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 10 2
A getValue() 0 4 1
A getReason() 0 4 1
A getType() 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\Suppression\Whitelist;
13
14
use DateTimeImmutable;
15
16
/**
17
 * @author Artem Bondarenko <[email protected]>
18
 */
19
class Whitelist
20
{
21
    private $value;
22
    private $reason;
23
    private $type;
24
    private $createdAt;
25
26
    private function __construct()
27
    {
28
    }
29
30
    public static function create(array $data): self
31
    {
32
        $model = new self();
33
        $model->value = $data['value'] ?? null;
34
        $model->reason = $data['reason'] ?? null;
35
        $model->type = $data['type'] ?? null;
36
        $model->createdAt = isset($data['createdAt']) ? new DateTimeImmutable($data['createdAt']) : null;
37
38
        return $model;
39
    }
40
41
    public function getValue(): ?string
42
    {
43
        return $this->value;
44
    }
45
46
    public function getReason(): ?string
47
    {
48
        return $this->reason;
49
    }
50
51
    public function getType(): ?string
52
    {
53
        return $this->type;
54
    }
55
56
    public function getCreatedAt(): ?DateTimeImmutable
57
    {
58
        return $this->createdAt;
59
    }
60
}
61