Completed
Push — master ( 3fbd33...51cff9 )
by David
02:08
created

ConnectionResponse   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 92.86%

Importance

Changes 0
Metric Value
dl 0
loc 43
c 0
b 0
f 0
wmc 5
lcom 1
cbo 0
ccs 13
cts 14
cp 0.9286
rs 10

4 Methods

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