Completed
Push — master ( 27d579...87c59d )
by David
02:18
created

UnsubscribeTracking   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 40
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 2
A __construct() 0 3 1
A isActive() 0 4 1
A getActive() 0 4 1
A getHtmlFooter() 0 4 1
A getTextFooter() 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 a single Unsubscribe Tracking setting for a domain tracking.
16
 *
17
 * @author Artem Bondarenko <[email protected]>
18
 */
19
final class UnsubscribeTracking
20
{
21
    private $active;
22
    private $htmlFooter;
23
    private $textFooter;
24
25 3
    public static function create(array $data): self
26
    {
27 3
        $model = new self();
28 3
        $model->active = ($data['active'] ?? null) ? 'yes' : 'no';
29 3
        $model->htmlFooter = $data['html_footer'] ?? '';
30 3
        $model->textFooter = $data['text_footer'] ?? '';
31
32 3
        return $model;
33
    }
34
35 3
    private function __construct()
36
    {
37 3
    }
38
39 3
    public function isActive(): bool
40
    {
41 3
        return 'yes' === $this->getActive();
42
    }
43
44 3
    public function getActive(): string
45
    {
46 3
        return $this->active;
47
    }
48
49 3
    public function getHtmlFooter(): string
50
    {
51 3
        return $this->htmlFooter;
52
    }
53
54 3
    public function getTextFooter(): string
55
    {
56 3
        return $this->textFooter;
57
    }
58
}
59