for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Yiisoft\Queue\Message;
trait EnvelopeTrait
{
private MessageInterface $message;
public function getMessage(): MessageInterface
return $this->message;
}
public function withMessage(MessageInterface $message): self
$instance = clone $this;
$instance->message = $message;
return $instance;
public function getHandlerName(): string
return $this->message->getHandlerName();
public function getData(): mixed
return $this->message->getData();
public function getMetadata(): array
return array_merge(
$this->message->getMetadata(),
[
self::ENVELOPE_STACK_KEY => array_merge(
Yiisoft\Queue\Message\En...ait::ENVELOPE_STACK_KEY
$this->message->getMetadata()[self::ENVELOPE_STACK_KEY] ?? [],
[self::class],
),
],
$this->getEnvelopeMetadata(),
);
public function getEnvelopeMetadata(): array
return [];