| @@ 8-47 (lines=40) @@ | ||
| 5 | ||
| 6 | use Innmind\AMQP\Client\Channel as ChannelInterface; |
|
| 7 | ||
| 8 | final class Fluent implements ChannelInterface |
|
| 9 | { |
|
| 10 | private $channel; |
|
| 11 | ||
| 12 | public function __construct(ChannelInterface $channel) |
|
| 13 | { |
|
| 14 | $this->channel = $channel; |
|
| 15 | } |
|
| 16 | ||
| 17 | public function exchange(): Exchange |
|
| 18 | { |
|
| 19 | return $this->channel->exchange(); |
|
| 20 | } |
|
| 21 | ||
| 22 | public function queue(): Queue |
|
| 23 | { |
|
| 24 | return $this->channel->queue(); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function basic(): Basic |
|
| 28 | { |
|
| 29 | return $this->channel->basic(); |
|
| 30 | } |
|
| 31 | ||
| 32 | public function transaction(): Transaction |
|
| 33 | { |
|
| 34 | return $this->channel->transaction(); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function closed(): bool |
|
| 38 | { |
|
| 39 | return $this->channel->closed(); |
|
| 40 | } |
|
| 41 | ||
| 42 | public function close(): void |
|
| 43 | { |
|
| 44 | $this->channel->close(); |
|
| 45 | $this->channel = new NullChannel; |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||
| @@ 9-54 (lines=46) @@ | ||
| 6 | use Innmind\AMQP\Client\Channel as ChannelInterface; |
|
| 7 | use Psr\Log\LoggerInterface; |
|
| 8 | ||
| 9 | final class Logger implements ChannelInterface |
|
| 10 | { |
|
| 11 | private $channel; |
|
| 12 | private $basic; |
|
| 13 | ||
| 14 | public function __construct( |
|
| 15 | ChannelInterface $channel, |
|
| 16 | LoggerInterface $logger |
|
| 17 | ) { |
|
| 18 | $this->channel = $channel; |
|
| 19 | $this->basic = new Basic\Logger( |
|
| 20 | $channel->basic(), |
|
| 21 | $logger |
|
| 22 | ); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function exchange(): Exchange |
|
| 26 | { |
|
| 27 | return $this->channel->exchange(); |
|
| 28 | } |
|
| 29 | ||
| 30 | public function queue(): Queue |
|
| 31 | { |
|
| 32 | return $this->channel->queue(); |
|
| 33 | } |
|
| 34 | ||
| 35 | public function basic(): Basic |
|
| 36 | { |
|
| 37 | return $this->basic; |
|
| 38 | } |
|
| 39 | ||
| 40 | public function transaction(): Transaction |
|
| 41 | { |
|
| 42 | return $this->channel->transaction(); |
|
| 43 | } |
|
| 44 | ||
| 45 | public function closed(): bool |
|
| 46 | { |
|
| 47 | return $this->channel->closed(); |
|
| 48 | } |
|
| 49 | ||
| 50 | public function close(): void |
|
| 51 | { |
|
| 52 | $this->channel->close(); |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||