| 1 | <?php |
||
| 10 | class Message implements WritableMessage |
||
| 11 | { |
||
| 12 | use BodySetter; |
||
| 13 | |||
| 14 | protected |
||
| 15 | $body; |
||
| 16 | |||
| 17 | private |
||
| 18 | $canBeDroppedSilently, |
||
|
1 ignored issue
–
show
|
|||
| 19 | $headers, |
||
| 20 | $attributes; |
||
| 21 | |||
| 22 | 23 | public function __construct($routingKey = '') |
|
| 30 | |||
| 31 | 23 | private function initializeAttributes() |
|
| 56 | |||
| 57 | 8 | private function generateBodyId() |
|
| 66 | |||
| 67 | 1 | public function canBeDroppedSilently() |
|
| 68 | { |
||
| 69 | 1 | return $this->canBeDroppedSilently; |
|
| 70 | } |
||
| 71 | |||
| 72 | 1 | public function disallowSilentDropping() |
|
| 73 | { |
||
| 74 | 1 | $this->canBeDroppedSilently = false; |
|
| 75 | |||
| 76 | 1 | return $this; |
|
| 77 | } |
||
| 78 | |||
| 79 | 23 | public function getContentType() |
|
| 80 | { |
||
| 81 | 23 | return $this->body->getContentType(); |
|
| 82 | } |
||
| 83 | |||
| 84 | 19 | public function getRoutingKey() |
|
| 85 | { |
||
| 86 | 19 | return $this->getAttribute('routing_key'); |
|
| 87 | } |
||
| 88 | |||
| 89 | 1 | public function getBodyInTransportFormat() |
|
| 90 | { |
||
| 91 | 1 | return $this->body->asTransported(); |
|
| 92 | } |
||
| 93 | |||
| 94 | 5 | public function setBody(Body $body) |
|
| 95 | { |
||
| 96 | 5 | $this->body = $body; |
|
| 97 | 5 | $this->updateContentType(); |
|
| 98 | |||
| 99 | 5 | return $this; |
|
| 100 | } |
||
| 101 | |||
| 102 | 12 | private function updateContentType() |
|
| 103 | { |
||
| 104 | 12 | $this->attributes['content_type'] = $this->body->getContentType(); |
|
| 105 | 12 | } |
|
| 106 | |||
| 107 | 13 | public function addHeader($headerName, $value) |
|
| 113 | |||
| 114 | 3 | public function addHeaders(array $headers) |
|
| 123 | |||
| 124 | 1 | public function setAuthor($author) |
|
| 130 | |||
| 131 | 10 | public function packAttributes($timestamp = false) |
|
| 151 | |||
| 152 | 10 | private function packHeaders($timestamp) |
|
| 158 | |||
| 159 | 23 | public function setAttribute($attributeName, $value) |
|
| 171 | |||
| 172 | public function getAppId() |
||
| 176 | |||
| 177 | 3 | public function getHeaders() |
|
| 183 | |||
| 184 | 21 | public function getAttribute($attributeName) |
|
| 193 | |||
| 194 | 1 | public function __toString() |
|
| 203 | |||
| 204 | 1 | public function setExpiration($expirationInSeconds) |
|
| 212 | |||
| 213 | 2 | public static function buildFromReadableMessage(ReadableMessage $readableMessage, $newRoutingKey = false) |
|
| 239 | } |
||
| 240 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.