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

Member::__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\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