yiisoft /
queue
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Yiisoft\Queue\Message; |
||
| 6 | |||
| 7 | trait EnvelopeTrait |
||
| 8 | { |
||
| 9 | private MessageInterface $message; |
||
| 10 | |||
| 11 | 4 | public function getMessage(): MessageInterface |
|
| 12 | { |
||
| 13 | 4 | return $this->message; |
|
| 14 | } |
||
| 15 | |||
| 16 | public function withMessage(MessageInterface $message): self |
||
| 17 | { |
||
| 18 | $instance = clone $this; |
||
| 19 | $instance->message = $message; |
||
| 20 | |||
| 21 | return $instance; |
||
| 22 | } |
||
| 23 | |||
| 24 | 8 | public function getHandlerName(): string |
|
| 25 | { |
||
| 26 | 8 | return $this->message->getHandlerName(); |
|
| 27 | } |
||
| 28 | |||
| 29 | 4 | public function getData(): mixed |
|
| 30 | { |
||
| 31 | 4 | return $this->message->getData(); |
|
| 32 | } |
||
| 33 | |||
| 34 | 12 | public function getMetadata(): array |
|
| 35 | { |
||
| 36 | 12 | return array_merge( |
|
| 37 | 12 | $this->message->getMetadata(), |
|
| 38 | 12 | [ |
|
| 39 | 12 | self::ENVELOPE_STACK_KEY => array_merge( |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 40 | 12 | $this->message->getMetadata()[self::ENVELOPE_STACK_KEY] ?? [], |
|
| 41 | 12 | [self::class], |
|
| 42 | 12 | ), |
|
| 43 | 12 | ], |
|
| 44 | 12 | $this->getEnvelopeMetadata(), |
|
| 45 | 12 | ); |
|
| 46 | } |
||
| 47 | |||
| 48 | public function getEnvelopeMetadata(): array |
||
| 49 | { |
||
| 50 | return []; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |