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

Complaint::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\Complaint;
13
14
/**
15
 * @author Sean Johnson <[email protected]>
16
 */
17
class Complaint
18
{
19
    private $address;
20
    private $createdAt;
21
22
    private function __construct()
23
    {
24
    }
25
26
    public static function create(array $data): self
27
    {
28
        $model = new self();
29
30
        $model->address = $data['address'] ?? null;
31
        $model->createdAt = isset($data['created_at']) ? new \DateTimeImmutable($data['created_at']) : null;
32
33
        return $model;
34
    }
35
36
    public function getAddress(): ?string
37
    {
38
        return $this->address;
39
    }
40
41
    public function getCreatedAt(): ?\DateTimeImmutable
42
    {
43
        return $this->createdAt;
44
    }
45
}
46