| Total Complexity | 6 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class AmqpMessagePublisher |
||
| 9 | { |
||
| 10 | /** @var AMQPChannel */ |
||
| 11 | private $channel; |
||
| 12 | /** @var string */ |
||
| 13 | private $queue; |
||
| 14 | /** @var string */ |
||
| 15 | private $exchange; |
||
| 16 | /** @var int */ |
||
| 17 | private $batch = 0; |
||
| 18 | /** @var bool */ |
||
| 19 | private $persistant; |
||
| 20 | |||
| 21 | public function __construct(AMQPChannel $channel, string $queue, string $exchange, bool $persistant) |
||
| 22 | { |
||
| 23 | $this->channel = $channel; |
||
| 24 | $this->queue = $queue; |
||
| 25 | $this->exchange = $exchange; |
||
| 26 | $this->persistant = $persistant; |
||
| 27 | |||
| 28 | $this->channel->queue_declare($this->queue, false, $this->persistant); |
||
| 29 | $this->channel->queue_bind($this->queue, $this->exchange, $this->queue); |
||
| 30 | } |
||
| 31 | |||
| 32 | public function publish(string $message, int $batchCount) |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | public function finalize() |
||
| 43 | { |
||
| 44 | $this->flush(); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function flush() |
||
| 48 | { |
||
| 49 | $this->channel->publish_batch(); |
||
| 50 | } |
||
| 51 | |||
| 52 | public function countMessages(): int |
||
| 55 | } |
||
| 56 | } |
||
| 57 |