| 1 | <?php |
||
| 16 | class QueueDelete extends Frame |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var int |
||
| 20 | */ |
||
| 21 | private $reserved1; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var string |
||
| 25 | */ |
||
| 26 | private $queue; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var bool |
||
| 30 | */ |
||
| 31 | private $ifUnused; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var bool |
||
| 35 | */ |
||
| 36 | private $ifEmpty; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var bool |
||
| 40 | */ |
||
| 41 | private $noWait; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @param int $channel |
||
| 45 | * @param int $reserved1 |
||
| 46 | * @param string $queue |
||
| 47 | * @param bool $ifUnused |
||
| 48 | * @param bool $ifEmpty |
||
| 49 | * @param bool $noWait |
||
| 50 | */ |
||
| 51 | public function __construct($channel, $reserved1, $queue, $ifUnused, $ifEmpty, $noWait) |
||
| 52 | { |
||
| 53 | $this->reserved1 = $reserved1; |
||
| 54 | $this->queue = $queue; |
||
| 55 | $this->ifUnused = $ifUnused; |
||
| 56 | $this->ifEmpty = $ifEmpty; |
||
| 57 | $this->noWait = $noWait; |
||
| 58 | |||
| 59 | parent::__construct($channel); |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Reserved1. |
||
| 64 | * |
||
| 65 | * @return int |
||
| 66 | */ |
||
| 67 | public function getReserved1() |
||
| 68 | { |
||
| 69 | return $this->reserved1; |
||
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Queue. |
||
| 74 | * |
||
| 75 | * @return string |
||
| 76 | */ |
||
| 77 | public function getQueue() |
||
| 78 | { |
||
| 79 | return $this->queue; |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Delete only if unused. |
||
| 84 | * |
||
| 85 | * @return bool |
||
| 86 | */ |
||
| 87 | public function isIfUnused() |
||
| 88 | { |
||
| 89 | return $this->ifUnused; |
||
| 90 | } |
||
| 91 | |||
| 92 | /** |
||
| 93 | * Delete only if empty. |
||
| 94 | * |
||
| 95 | * @return bool |
||
| 96 | */ |
||
| 97 | public function isIfEmpty() |
||
| 98 | { |
||
| 99 | return $this->ifEmpty; |
||
| 100 | } |
||
| 101 | |||
| 102 | /** |
||
| 103 | * NoWait. |
||
| 104 | * |
||
| 105 | * @return bool |
||
| 106 | */ |
||
| 107 | public function isNoWait() |
||
| 108 | { |
||
| 109 | return $this->noWait; |
||
| 110 | } |
||
| 111 | |||
| 112 | /** |
||
| 113 | * @return string |
||
| 114 | */ |
||
| 115 | public function encode() |
||
| 116 | { |
||
| 117 | $data = "\x00\x32\x00\x28". |
||
| 118 | Value\ShortValue::encode($this->reserved1). |
||
| 119 | Value\ShortStringValue::encode($this->queue). |
||
| 120 | Value\OctetValue::encode(($this->ifUnused ? 1 : 0) | (($this->ifEmpty ? 1 : 0) << 1) | (($this->noWait ? 1 : 0) << 2)); |
||
| 121 | |||
| 122 | return "\x01".pack('nN', $this->channel, strlen($data)).$data."\xCE"; |
||
| 123 | } |
||
| 124 | } |
||
| 125 |