Completed
Push — master ( 503b9d...92f54d )
by Frederik
03:38
created

AppendCrlfConnection::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Genkgo\Mail\Protocol;
5
6
/**
7
 * Class AppendCrlfConnection
8
 * @package Genkgo\Mail\Protocol
9
 */
10
final class AppendCrlfConnection implements ConnectionInterface
11
{
12
    /**
13
     * @var ConnectionInterface
14
     */
15
    private $decoratedConnection;
16
17
    /**
18
     * AppendCrlfConnection constructor.
19
     * @param ConnectionInterface $decoratedConnection
20
     */
21 27
    public function __construct(ConnectionInterface $decoratedConnection)
22
    {
23 27
        $this->decoratedConnection = $decoratedConnection;
24 27
    }
25
26
    /**
27
     * @param string $name
28
     * @param \Closure $callback
29
     */
30 26
    public function addListener(string $name, \Closure $callback): void
31
    {
32 26
        $this->decoratedConnection->addListener($name, $callback);
33 26
    }
34
35
    /**
36
     * @return void
37
     */
38 1
    public function connect(): void
39
    {
40 1
        $this->decoratedConnection->connect();
41 1
    }
42
43
    /**
44
     * @return void
45
     */
46 1
    public function disconnect(): void
47
    {
48 1
        $this->decoratedConnection->disconnect();
49 1
    }
50
51
    /**
52
     * @param string $request
53
     * @return int
54
     */
55 15
    public function send(string $request): int
56
    {
57 15
        return $this->decoratedConnection->send($request . "\r\n");
58
    }
59
60
    /**
61
     * @return string
62
     */
63 13
    public function receive(): string
64
    {
65 13
        return $this->decoratedConnection->receive();
66
    }
67
68
    /**
69
     * @param int $type
70
     */
71 1
    public function upgrade(int $type): void
72
    {
73 1
        $this->decoratedConnection->upgrade($type);
74 1
    }
75
76
    /**
77
     * @param float $timeout
78
     */
79 1
    public function timeout(float $timeout): void
80
    {
81 1
        $this->decoratedConnection->timeout($timeout);
82 1
    }
83
84
    /**
85
     * @param array $keys
86
     * @return array
87
     */
88 1
    public function getMetaData(array $keys = []): array
89
    {
90 1
        return $this->decoratedConnection->getMetaData($keys);
91
    }
92
}