Completed
Push — master ( 766570...edcfcc )
by Tobias
04:19
created

UpdateResponse::getRoute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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