Completed
Push — master ( ac056e...2fe264 )
by David
04:27 queued 01:15
created

Member   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 76.47%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 42
ccs 13
cts 17
cp 0.7647
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 1
A __construct() 0 3 1
A getName() 0 4 1
A getAddress() 0 4 1
A getVars() 0 4 1
A isSubscribed() 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\MailingList\Member;
13
14
use Mailgun\Model\ApiResponse;
15
16
final class Member implements ApiResponse
17
{
18
    private $name;
19
    private $address;
20
    private $vars;
21
    private $subscribed;
22
23 4
    public static function create(array $data): self
24
    {
25 4
        $model = new self();
26 4
        $model->name = $data['name'] ?? null;
27 4
        $model->address = $data['address'] ?? null;
28 4
        $model->vars = $data['vars'] ?? [];
29 4
        $model->subscribed = $data['subscribed'] ?? null;
30
31 4
        return $model;
32
    }
33
34 4
    private function __construct()
35
    {
36 4
    }
37
38 3
    public function getName(): ?string
39
    {
40 3
        return $this->name;
41
    }
42
43 1
    public function getAddress(): ?string
44
    {
45 1
        return $this->address;
46
    }
47
48
    public function getVars(): array
49
    {
50
        return $this->vars;
51
    }
52
53
    public function isSubscribed(): ?bool
54
    {
55
        return $this->subscribed;
56
    }
57
}
58