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

ShowResponse   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 35
ccs 8
cts 9
cp 0.8889
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 2
A __construct() 0 4 1
A getRoute() 0 4 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