Completed
Push — master ( 6a943d...2b60fb )
by David
02:17
created

UpdateResponse::getMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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