| Total Complexity | 8 |
| Total Lines | 82 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class Message implements MessageInterface |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var array |
||
| 9 | */ |
||
| 10 | protected $headers; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | protected $body; |
||
| 16 | |||
| 17 | public function __construct() |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @return array |
||
| 24 | */ |
||
| 25 | public function getHeaders(): array |
||
| 26 | { |
||
| 27 | return $this->headers; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param array $headers |
||
| 32 | * |
||
| 33 | * @return \Jellyfish\Queue\MessageInterface |
||
| 34 | */ |
||
| 35 | public function setHeaders(array $headers): MessageInterface |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param string $key |
||
| 44 | * |
||
| 45 | * @return string|null |
||
| 46 | */ |
||
| 47 | public function getHeader(string $key): ?string |
||
| 48 | { |
||
| 49 | if (!\array_key_exists($key, $this->headers)) { |
||
| 50 | return null; |
||
| 51 | } |
||
| 52 | |||
| 53 | return $this->headers[$key]; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @param string $key |
||
| 58 | * @param string $value |
||
| 59 | * |
||
| 60 | * @return \Jellyfish\Queue\MessageInterface |
||
| 61 | */ |
||
| 62 | public function setHeader(string $key, string $value): MessageInterface |
||
| 63 | { |
||
| 64 | $this->headers[$key] = $value; |
||
| 65 | |||
| 66 | return $this; |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @return string |
||
| 71 | */ |
||
| 72 | public function getBody(): string |
||
| 73 | { |
||
| 74 | return $this->body; |
||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @param string $body |
||
| 79 | * |
||
| 80 | * @return \Jellyfish\Queue\MessageInterface |
||
| 81 | */ |
||
| 82 | public function setBody(string $body): MessageInterface |
||
| 87 | } |
||
| 88 | } |
||
| 89 |