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