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

UnsubscribeTracking::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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