Completed
Push — master ( cf00e0...a6178b )
by Frederik
02:20
created

SecureConnectionOptions   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 2
cbo 0
dl 0
loc 59
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A withTimeout() 0 6 1
A withMethod() 0 6 1
A getTimeout() 0 4 1
A getMethod() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Genkgo\Mail\Protocol;
5
6
/**
7
 * Class SecureConnectionOptions
8
 * @package Genkgo\Mail\Protocol
9
 * @codeCoverageIgnore
10
 */
11
final class SecureConnectionOptions
12
{
13
    /**
14
     * @var float
15
     */
16
    private $timeout = 10;
17
18
    /**
19
     * @var int
20
     */
21
    private $method;
22
23
    /**
24
     * SecureConnectionOptions constructor.
25
     * @param int $method
26
     */
27
    public function __construct(int $method)
28
    {
29
        $this->method = $method;
30
    }
31
32
    /**
33
     * @param float $connectionTimeout
34
     * @return SecureConnectionOptions
35
     */
36
    public function withTimeout(float $connectionTimeout): SecureConnectionOptions
37
    {
38
        $clone = clone $this;
39
        $clone->timeout = $connectionTimeout;
40
        return $clone;
41
    }
42
43
    /**
44
     * @param int $method
45
     * @return SecureConnectionOptions
46
     */
47
    public function withMethod(int $method): SecureConnectionOptions
48
    {
49
        $clone = clone $this;
50
        $clone->method = $method;
51
        return $clone;
52
    }
53
54
    /**
55
     * @return float
56
     */
57
    public function getTimeout(): float
58
    {
59
        return $this->timeout;
60
    }
61
62
    /**
63
     * @return int
64
     */
65
    public function getMethod(): int
66
    {
67
        return $this->method;
68
    }
69
}