Completed
Push — master ( b3f24e...84a5c5 )
by Tobias
03:15
created

BaseResponse   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 51
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A create() 0 7 3
A getAddress() 0 4 1
A getMessage() 0 4 1
1
<?php
2
3
/*
4
 * Copyright (C) 2013-2016 Mailgun
5
 *
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Mailgun\Model\Suppression;
11
12
use Mailgun\Model\ApiResponse;
13
14
/**
15
 * Serves only as an abstract base for Suppression API code.
16
 *
17
 * @author Sean Johnson <[email protected]>
18
 */
19
abstract class BaseResponse implements ApiResponse
20
{
21
    /**
22
     * @var string
23
     */
24
    private $address;
25
26
    /**
27
     * @var string
28
     */
29
    private $message;
30
31
    /**
32
     * @param string $address
33
     * @param string $message
34
     */
35
    private function __construct($address, $message)
36
    {
37
        $this->address = $address;
38
        $this->message = $message;
39
    }
40
41
    /**
42
     * @param array $data
43
     *
44
     * @return BaseResponse
45
     */
46
    public static function create(array $data)
47
    {
48
        $address = isset($data['address']) ? $data['address'] : '';
49
        $message = isset($data['message']) ? $data['message'] : '';
50
51
        return new static($address, $message);
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getAddress()
58
    {
59
        return $this->address;
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function getMessage()
66
    {
67
        return $this->message;
68
    }
69
}
70