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 |
||
51 | public function send(Message $message) |
||
52 | { |
||
53 | $rawMessage = $this->getMessageEncoder()->encode($message); |
||
54 | |||
55 | $attributes = array( |
||
56 | 'Content-type' => 'application/json' |
||
57 | ); |
||
58 | |||
59 | // if queue is durable then mark message as 'persistent' |
||
60 | if (($this->queue->getFlags() & AMQP_DURABLE) > 0) { |
||
61 | $attributes['delivery_mode'] = 2; |
||
62 | } |
||
63 | |||
64 | $this->exchange->publish( |
||
65 | $rawMessage, |
||
66 | $this->queue->getName(), |
||
67 | AMQP_NOPARAM, |
||
68 | $attributes |
||
69 | ); |
||
70 | return 1; |
||
71 | } |
||
73 |