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