| Total Complexity | 9 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | final class Channel implements ChannelInterfce |
||
| 14 | { |
||
| 15 | private $connection; |
||
| 16 | private $number; |
||
| 17 | private $exchange; |
||
| 18 | private $queue; |
||
| 19 | private $basic; |
||
| 20 | private $transaction; |
||
| 21 | private $closed = false; |
||
| 22 | |||
| 23 | 8 | public function __construct(Connection $connection, Number $number) |
|
| 24 | { |
||
| 25 | 8 | $this->connection = $connection; |
|
| 26 | 8 | $this->number = $number; |
|
| 27 | |||
| 28 | $connection |
||
| 29 | 8 | ->send($connection->protocol()->channel()->open($number)) |
|
| 30 | 8 | ->wait('channel.open-ok'); |
|
| 31 | |||
| 32 | 8 | $this->exchange = new Exchange\Exchange($connection, $number); |
|
| 33 | 8 | $this->queue = new Queue\Queue($connection, $number); |
|
| 34 | 8 | $this->basic = new Basic\Basic($connection, $number); |
|
| 35 | 8 | $this->transaction = new Transaction\Transaction($connection, $number); |
|
| 36 | 8 | } |
|
| 37 | |||
| 38 | 2 | public function exchange(): Exchange |
|
| 39 | { |
||
| 40 | 2 | return $this->exchange; |
|
| 41 | } |
||
| 42 | |||
| 43 | 2 | public function queue(): Queue |
|
| 44 | { |
||
| 45 | 2 | return $this->queue; |
|
| 46 | } |
||
| 47 | |||
| 48 | 2 | public function basic(): Basic |
|
| 49 | { |
||
| 50 | 2 | return $this->basic; |
|
| 51 | } |
||
| 52 | |||
| 53 | 2 | public function transaction(): Transaction |
|
| 54 | { |
||
| 55 | 2 | return $this->transaction; |
|
| 56 | } |
||
| 57 | |||
| 58 | 6 | public function closed(): bool |
|
| 61 | } |
||
| 62 | |||
| 63 | 4 | public function close(): void |
|
| 64 | { |
||
| 65 | 4 | if ($this->closed()) { |
|
| 66 | 2 | return; |
|
| 79 |