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

ConnectionResponse::create()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 4.0312

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 7
cts 8
cp 0.875
rs 9.2
c 0
b 0
f 0
cc 4
eloc 7
nc 2
nop 1
crap 4.0312
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