1
|
|
|
<?php |
2
|
|
|
declare(strict_types = 1); |
3
|
|
|
|
4
|
|
|
namespace Innmind\AMQP\Transport\Protocol\v091; |
5
|
|
|
|
6
|
|
|
use Innmind\AMQP\Transport\{ |
7
|
|
|
Protocol as ProtocolInterface, |
8
|
|
|
Protocol\Version, |
9
|
|
|
Protocol\Connection as ConnectionInterface, |
10
|
|
|
Protocol\Exchange as ExchangeInterface, |
11
|
|
|
Protocol\Queue as QueueInterface, |
12
|
|
|
Protocol\Basic as BasicInterface, |
13
|
|
|
Protocol\Transaction as TransactionInterface, |
14
|
|
|
Frame\Method |
15
|
|
|
}; |
16
|
|
|
use Innmind\Immutable\{ |
17
|
|
|
Str, |
18
|
|
|
StreamInterface |
19
|
|
|
}; |
20
|
|
|
|
21
|
|
|
final class Protocol implements ProtocolInterface |
|
|
|
|
22
|
|
|
{ |
23
|
|
|
private $version; |
24
|
|
|
private $read; |
25
|
|
|
private $connection; |
26
|
|
|
private $exchange; |
27
|
|
|
private $queue; |
28
|
|
|
private $basic; |
29
|
|
|
private $transaction; |
30
|
|
|
|
31
|
|
|
public function __construct() |
32
|
|
|
{ |
33
|
|
|
$this->version = new Version(0, 9, 1); |
34
|
|
|
$this->read = new Reader; |
35
|
|
|
$this->connection = new Connection; |
36
|
|
|
$this->exchange = new Exchange; |
37
|
|
|
$this->queue = new Queue; |
38
|
|
|
$this->basic = new Basic; |
39
|
|
|
$this->transaction = new Transaction; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function version(): Version |
43
|
|
|
{ |
44
|
|
|
return $this->version; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* {@inheritdoc} |
49
|
|
|
*/ |
50
|
|
|
public function read(Method $method, Str $arguments): StreamInterface |
51
|
|
|
{ |
52
|
|
|
return ($this->read)($method, $arguments); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function connection(): ConnectionInterface |
56
|
|
|
{ |
57
|
|
|
return $this->connection; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function exchange(): ExchangeInterface |
61
|
|
|
{ |
62
|
|
|
return $this->exchange; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function queue(): QueueInterface |
66
|
|
|
{ |
67
|
|
|
return $this->queue; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function basic(): BasicInterface |
71
|
|
|
{ |
72
|
|
|
return $this->basic; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function transaction(): TransactionInterface |
76
|
|
|
{ |
77
|
|
|
return $this->transaction; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|