Completed
Push — master ( 091134...c0a386 )
by Tobias
04:29
created

ShowResponse::getRoute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * Copyright (C) 2013 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\Route\Route;
13
use Mailgun\Model\ApiResponse;
14
15
/**
16
 * @author David Garcia <[email protected]>
17
 */
18
final class ShowResponse implements ApiResponse
19
{
20
    /**
21
     * @var Route|null
22
     */
23
    private $route;
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 1
    public static function create(array $data)
29
    {
30 1
        if (isset($data['route'])) {
31 1
            return new self(Route::create($data['route']));
32
        }
33
34
        return new self();
35
    }
36
37
    /**
38
     * ShowResponse constructor.
39
     *
40
     * @param Route|null $route
41
     */
42 1
    private function __construct(Route $route = null)
43
    {
44 1
        $this->route = $route;
45 1
    }
46
47
    /**
48
     * @return Route|null
49
     */
50 1
    public function getRoute()
51
    {
52 1
        return $this->route;
53
    }
54
}
55