Completed
Push — master ( a79b8b...cbb135 )
by Tobias
02:50
created

Unsubscribe   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 35
ccs 10
cts 14
cp 0.7143
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 9 2
A getAddress() 0 4 1
A getCreatedAt() 0 4 1
A getTags() 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\Unsubscribe;
13
14
/**
15
 * @author Sean Johnson <[email protected]>
16
 */
17
class Unsubscribe
18
{
19
    private $address;
20
    private $createdAt;
21
    private $tags = [];
22
23 2
    private function __construct()
24
    {
25 2
    }
26
27 2
    public static function create(array $data): self
28
    {
29 2
        $model = new self();
30 2
        $model->tags = $data['tags'] ?? [];
31 2
        $model->address = $data['address'] ?? null;
32 2
        $model->createdAt = isset($data['created_at']) ? new \DateTimeImmutable($data['created_at']) : null;
33
34 2
        return $model;
35
    }
36
37
    public function getAddress(): ?string
38
    {
39
        return $this->address;
40
    }
41
42
    public function getCreatedAt(): ?\DateTimeImmutable
43
    {
44
        return $this->createdAt;
45
    }
46
47 2
    public function getTags(): array
48
    {
49 2
        return $this->tags;
50
    }
51
}
52