Completed
Pull Request — master (#249)
by David
10:15
created

DeleteResponse::create()   A

Complexity

Conditions 3
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

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