Total Complexity | 5 |
Total Lines | 68 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
5 | class Message |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | protected $body; |
||
11 | |||
12 | /** |
||
13 | * Properties are similar to headers when using an \AMQPEnvelope object. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $properties; |
||
18 | |||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | protected $id; |
||
23 | |||
24 | /** |
||
25 | * __construct. |
||
26 | * |
||
27 | * In AMQP 0.9.1, a message contains properties. One of this properties is |
||
28 | * "headers". |
||
29 | * In AMQP 1.0, a message contains both properties and headers. |
||
30 | * |
||
31 | * For example, RabbitMQ implement AMQP 0.9.1. |
||
32 | * The "getHeaders" method of "\AMQPEnvelope" object actually return |
||
33 | * message properties AND headers at the same level. |
||
34 | * But if you want to have additional informations, you have to put it in |
||
35 | * the "headers" property. All unknown properties will be deleted by the |
||
36 | * broker. |
||
37 | * |
||
38 | * More information on AMQP version: |
||
39 | * |
||
40 | * @see: http://www.amqp.org/resources/download |
||
41 | * |
||
42 | * @param mixed $body |
||
43 | * @param array $properties |
||
44 | * @param mixed $id |
||
45 | */ |
||
46 | public function __construct($body = null, array $properties = [], $id = null) |
||
47 | { |
||
48 | $this->body = $body; |
||
49 | $this->properties = $properties; |
||
50 | $this->id = $id; |
||
51 | } |
||
52 | |||
53 | public function getBody() |
||
54 | { |
||
55 | return $this->body; |
||
56 | } |
||
57 | |||
58 | public function getHeaders() |
||
59 | { |
||
60 | trigger_error('getHeaders() method is deprecated. Use getProperties().', E_USER_DEPRECATED); |
||
61 | |||
62 | return $this->getProperties(); |
||
63 | } |
||
64 | |||
65 | public function getProperties() |
||
68 | } |
||
69 | |||
70 | public function getId() |
||
71 | { |
||
75 |