Completed
Push — master ( fab86b...27b5c8 )
by Tobias
10:27 queued 07:31
created

ConnectionResponse   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 93.75%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 56
ccs 15
cts 16
cp 0.9375
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 12 4
A __construct() 0 5 1
A getSkipVerification() 0 4 1
A getRequireTLS() 0 4 1
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\Domain;
11
12
use Mailgun\Model\ApiResponse;
13
14
/**
15
 * @author Sean Johnson <[email protected]>
16
 */
17
final class ConnectionResponse implements ApiResponse
18
{
19
    /**
20
     * @var bool
21
     */
22
    private $noVerify;
23
24
    /**
25
     * @var bool
26
     */
27
    private $requireTLS;
28
29
    /**
30
     * @param array $data
31
     *
32
     * @return self
33
     */
34 1
    public static function create(array $data)
35
    {
36 1
        if (!isset($data['connection'])) {
37
            return;
38
        }
39 1
        $connSettings = $data['connection'];
40
41 1
        return new self(
42 1
            isset($connSettings['skip_verification']) ? $connSettings['skip_verification'] : null,
43 1
            isset($connSettings['require_tls']) ? $connSettings['require_tls'] : null
44 1
        );
45
    }
46
47
    /**
48
     * @param bool $noVerify   Disable remote TLS certificate verification
49
     * @param bool $requireTLS Requires TLS for all outbound communication
50
     */
51 1
    private function __construct($noVerify, $requireTLS)
52
    {
53 1
        $this->noVerify = $noVerify;
54 1
        $this->requireTLS = $requireTLS;
55 1
    }
56
57
    /**
58
     * @return bool
59
     */
60 1
    public function getSkipVerification()
61
    {
62 1
        return $this->noVerify;
63
    }
64
65
    /**
66
     * @return bool
67
     */
68 1
    public function getRequireTLS()
69
    {
70 1
        return $this->requireTLS;
71
    }
72
}
73