Completed
Pull Request — master (#247)
by Tobias
05:45
created

SendResponse::create()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 14
Code Lines 8

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 8
nc 4
nop 1
1
<?php
2
3
namespace Mailgun\Resource\Api\Message;
4
5
use Mailgun\Resource\ApiResponse;
6
7
/**
8
 * @author Tobias Nyholm <[email protected]>
9
 */
10
class SendResponse implements ApiResponse
11
{
12
    /**
13
     * @var string
14
     */
15
    private $id;
16
17
    /**
18
     * @var string
19
     */
20
    private $message;
21
22
    /**
23
     * @param string $id
24
     * @param string $message
25
     */
26
    private function __construct($id, $message)
27
    {
28
        $this->id = $id;
29
        $this->message = $message;
30
    }
31
32
    /**
33
     * @param array $data
34
     *
35
     * @return SendResponse
36
     */
37 View Code Duplication
    public static function create(array $data)
0 ignored issues
show
Duplication introduced by
This method 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...
38
    {
39
        $id = '';
40
        $message = '';
41
42
        if (isset($data['id'])) {
43
            $id = $data['id'];
44
        }
45
        if (isset($data['message'])) {
46
            $message = $data['message'];
47
        }
48
49
        return new self($id, $message);
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getId()
56
    {
57
        return $this->id;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getMessage()
64
    {
65
        return $this->message;
66
    }
67
}
68