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

OpenTracking   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 30
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

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