AppendCrlfConnection::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Genkgo\Mail\Protocol;
5
6
final class AppendCrlfConnection implements ConnectionInterface
7
{
8
    /**
9
     * @var ConnectionInterface
10
     */
11
    private $decoratedConnection;
12
13
    /**
14
     * @param ConnectionInterface $decoratedConnection
15
     */
16 71
    public function __construct(ConnectionInterface $decoratedConnection)
17
    {
18 71
        $this->decoratedConnection = $decoratedConnection;
19 71
    }
20
21
    /**
22
     * @param string $name
23
     * @param \Closure $callback
24
     */
25 64
    public function addListener(string $name, \Closure $callback): void
26
    {
27 64
        $this->decoratedConnection->addListener($name, $callback);
28 64
    }
29
30
    /**
31
     * @return void
32
     */
33 1
    public function connect(): void
34
    {
35 1
        $this->decoratedConnection->connect();
36 1
    }
37
38
    /**
39
     * @return void
40
     */
41 7
    public function disconnect(): void
42
    {
43 7
        $this->decoratedConnection->disconnect();
44 7
    }
45
46
    /**
47
     * @param string $request
48
     * @return int
49
     */
50 51
    public function send(string $request): int
51
    {
52 51
        return $this->decoratedConnection->send($request . "\r\n");
53
    }
54
55
    /**
56
     * @return string
57
     */
58 45
    public function receive(): string
59
    {
60 45
        return $this->decoratedConnection->receive();
61
    }
62
63
    /**
64
     * @param int $type
65
     */
66 1
    public function upgrade(int $type): void
67
    {
68 1
        $this->decoratedConnection->upgrade($type);
69 1
    }
70
71
    /**
72
     * @param float $timeout
73
     */
74 1
    public function timeout(float $timeout): void
75
    {
76 1
        $this->decoratedConnection->timeout($timeout);
77 1
    }
78
79
    /**
80
     * @param array<int, string> $keys
81
     * @return array<string, mixed>
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
82
     */
83 1
    public function getMetaData(array $keys = []): array
84
    {
85 1
        return $this->decoratedConnection->getMetaData($keys);
86
    }
87
}
88