| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2.0185 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 51 | 1 | public function send(Message $message) |
|
| 52 | { |
||
| 53 | 1 | $rawMessage = $this->getMessageEncoder()->encode($message); |
|
| 54 | |||
| 55 | $attributes = array( |
||
| 56 | 'Content-type' => 'application/json' |
||
| 57 | 1 | ); |
|
| 58 | |||
| 59 | // if queue is durable then mark message as 'persistent' |
||
| 60 | 1 | if (($this->queue->getFlags() & AMQP_DURABLE) > 0) { |
|
| 61 | $attributes['delivery_mode'] = 2; |
||
| 62 | } |
||
| 63 | |||
| 64 | 1 | $this->exchange->publish( |
|
| 65 | 1 | $rawMessage, |
|
| 66 | 1 | $this->queue->getName(), |
|
| 67 | 1 | AMQP_NOPARAM, |
|
| 68 | $attributes |
||
| 69 | 1 | ); |
|
| 70 | 1 | return 1; |
|
| 71 | } |
||
| 73 |