Completed
Push — master ( 2fe264...259d91 )
by Tobias
02:17
created

Bounce::setCreatedAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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\Bounce;
13
14
/**
15
 * @author Sean Johnson <[email protected]>
16
 */
17
class Bounce
18
{
19
    private $address;
20
    private $code;
21
    private $error;
22
    private $createdAt;
23
24
    private function __construct()
25
    {
26
    }
27
28
    public static function create(array $data): self
29
    {
30
        $model = new self();
31
32
        $model->address = $data['address'] ?? null;
33
        $model->code = $data['code'] ?? null;
34
        $model->error = $data['error'] ?? null;
35
        $model->createdAt = isset($data['created_at']) ? new \DateTimeImmutable($data['created_at']) : null;
36
37
        return $model;
38
    }
39
40
    public function getAddress(): ?string
41
    {
42
        return $this->address;
43
    }
44
45
    public function getCode(): ?string
46
    {
47
        return $this->code;
48
    }
49
50
    public function getError(): ?string
51
    {
52
        return $this->error;
53
    }
54
55
    public function getCreatedAt(): ?\DateTimeImmutable
56
    {
57
        return $this->createdAt;
58
    }
59
}
60