| Total Complexity | 9 |
| Total Lines | 107 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 8 | class RabbitMQMessage |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Message stream. |
||
| 12 | * |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | protected string $stream; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Message exchange. |
||
| 19 | * |
||
| 20 | * @var RabbitMQExchange|null |
||
| 21 | */ |
||
| 22 | protected ?RabbitMQExchange $exchange = null; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Message config. |
||
| 26 | * |
||
| 27 | * @var Collection |
||
| 28 | */ |
||
| 29 | protected Collection $config; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Create a new RabbitMQ Message instance. |
||
| 33 | * |
||
| 34 | * @param string $stream |
||
| 35 | * @param array $config |
||
| 36 | */ |
||
| 37 | public function __construct(string $stream, array $config = []) |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Set message config. |
||
| 46 | * |
||
| 47 | * @param array $config |
||
| 48 | * @return RabbitMQMessage |
||
| 49 | */ |
||
| 50 | public function setConfig(array $config): self |
||
| 51 | { |
||
| 52 | $this->config = new Collection($config); |
||
|
|
|||
| 53 | |||
| 54 | return $this; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Get AMQP Message. |
||
| 59 | * |
||
| 60 | * @return AMQPMessage |
||
| 61 | */ |
||
| 62 | public function getAmqpMessage(): AMQPMessage |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Set message stream. |
||
| 69 | * |
||
| 70 | * @param string $stream |
||
| 71 | * @return self |
||
| 72 | */ |
||
| 73 | public function setStream(string $stream): self |
||
| 74 | { |
||
| 75 | $this->stream = $stream; |
||
| 76 | |||
| 77 | return $this; |
||
| 78 | } |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @return string |
||
| 82 | */ |
||
| 83 | public function getStream(): string |
||
| 84 | { |
||
| 85 | return $this->stream; |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @return Collection |
||
| 90 | */ |
||
| 91 | public function getConfig(): Collection |
||
| 92 | { |
||
| 93 | return $this->config; |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @return null|RabbitMQExchange |
||
| 98 | */ |
||
| 99 | public function getExchange(): ?RabbitMQExchange |
||
| 100 | { |
||
| 101 | return $this->exchange; |
||
| 102 | } |
||
| 103 | |||
| 104 | /** |
||
| 105 | * Set message exchange. |
||
| 106 | * |
||
| 107 | * @param RabbitMQExchange $exchange |
||
| 108 | * @return self |
||
| 109 | */ |
||
| 110 | public function setExchange(RabbitMQExchange $exchange): self |
||
| 115 | } |
||
| 116 | } |
||
| 117 |