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

src/Model/Suppression/BaseResponse.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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\Suppression;
13
14
use Mailgun\Model\ApiResponse;
15
16
/**
17
 * Serves only as an abstract base for Suppression API code.
18
 *
19
 * @author Sean Johnson <[email protected]>
20
 */
21 View Code Duplication
abstract class BaseResponse implements ApiResponse
0 ignored issues
show
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
{
23
    /**
24
     * @var string
25
     */
26
    private $address;
27
28
    /**
29
     * @var string
30
     */
31
    private $message;
32
33
    /**
34
     * @param string $address
35
     * @param string $message
36
     */
37
    private function __construct($address, $message)
38
    {
39
        $this->address = $address;
40
        $this->message = $message;
41
    }
42
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