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

ShowResponse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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