| Total Complexity | 6 |
| Total Lines | 62 |
| 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() |
||
| 18 | { |
||
| 19 | $this->headers = []; |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param string $key |
||
| 24 | * |
||
| 25 | * @return string|null |
||
| 26 | */ |
||
| 27 | public function getHeader(string $key): ?string |
||
| 28 | { |
||
| 29 | if (!\array_key_exists($key, $this->headers)) { |
||
| 30 | return null; |
||
| 31 | } |
||
| 32 | |||
| 33 | return $this->headers[$key]; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param string $key |
||
| 38 | * @param string $value |
||
| 39 | * |
||
| 40 | * @return \Jellyfish\Queue\MessageInterface |
||
| 41 | */ |
||
| 42 | public function setHeader(string $key, string $value): MessageInterface |
||
| 43 | { |
||
| 44 | $this->headers[$key] = $value; |
||
| 45 | |||
| 46 | return $this; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | public function getBody(): string |
||
| 53 | { |
||
| 54 | return $this->body; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @param string $body |
||
| 59 | * |
||
| 60 | * @return \Jellyfish\Queue\MessageInterface |
||
| 61 | */ |
||
| 62 | public function setBody(string $body): MessageInterface |
||
| 67 | } |
||
| 68 | } |
||
| 69 |