| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | public function send(Message $message): int |
||
| 39 | { |
||
| 40 | $rawMessage = $this->getMessageEncoder()->encode($message); |
||
| 41 | |||
| 42 | $attributes = [ |
||
| 43 | 'Content-type' => 'application/json' |
||
| 44 | ]; |
||
| 45 | |||
| 46 | // if queue is durable then mark message as 'persistent' |
||
| 47 | if (($this->queue->getFlags() & AMQP_DURABLE) > 0) { |
||
| 48 | $attributes['delivery_mode'] = 2; |
||
| 49 | } |
||
| 50 | |||
| 51 | $this->exchange->publish( |
||
| 52 | $rawMessage, |
||
| 53 | $this->queue->getName(), |
||
| 54 | AMQP_NOPARAM, |
||
| 55 | $attributes |
||
| 56 | ); |
||
| 57 | return 1; |
||
| 58 | } |
||
| 60 |