Completed
Push — master ( da873d...74929b )
by Tobias
03:47
created

ConnectionResponse::getSkipVerification()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
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\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
    public static function create(array $data)
35
    {
36
        if (!isset($data['connection'])) {
37
            return;
38
        }
39
        $connSettings = $data['connection'];
40
41
        return new self(
42
            isset($connSettings['skip_verification']) ? $connSettings['skip_verification'] : null,
43
            isset($connSettings['require_tls']) ? $connSettings['require_tls'] : null
44
        );
45
    }
46
47
    /**
48
     * @param bool $noVerify   Disable remote TLS certificate verification
49
     * @param bool $requireTLS Requires TLS for all outbound communication
50
     */
51
    private function __construct($noVerify, $requireTLS)
52
    {
53
        $this->noVerify = $noVerify;
54
        $this->requireTLS = $requireTLS;
55
    }
56
57
    /**
58
     * @return bool
59
     */
60
    public function getSkipVerification()
61
    {
62
        return $this->noVerify;
63
    }
64
65
    /**
66
     * @return bool
67
     */
68
    public function getRequireTLS()
69
    {
70
        return $this->requireTLS;
71
    }
72
}
73