| Total Complexity | 9 |
| Total Lines | 68 |
| Duplicated Lines | 0 % |
| Coverage | 63.64% |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 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 |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @return class-string<MessageHandlerInterface> |
||
|
|
|||
| 26 | */ |
||
| 27 | public function getHandler(): string |
||
| 28 | { |
||
| 29 | return $this->message->getHandler(); |
||
| 30 | } |
||
| 31 | |||
| 32 | 13 | public function getData(): mixed |
|
| 35 | } |
||
| 36 | |||
| 37 | 2 | public static function fromMessage(MessageInterface $message): self |
|
| 38 | { |
||
| 39 | 2 | return new static($message); |
|
| 40 | } |
||
| 41 | |||
| 42 | 12 | public function getMetadata(): array |
|
| 43 | { |
||
| 44 | 12 | return array_merge( |
|
| 45 | 12 | $this->message->getMetadata(), |
|
| 46 | 12 | [ |
|
| 47 | 12 | self::ENVELOPE_STACK_KEY => array_merge( |
|
| 48 | 12 | $this->message->getMetadata()[self::ENVELOPE_STACK_KEY] ?? [], |
|
| 49 | 12 | [self::class], |
|
| 50 | 12 | ), |
|
| 51 | 12 | ], |
|
| 52 | 12 | $this->getEnvelopeMetadata(), |
|
| 53 | 12 | ); |
|
| 54 | } |
||
| 55 | |||
| 56 | public function getEnvelopeMetadata(): array |
||
| 57 | { |
||
| 58 | return []; |
||
| 59 | } |
||
| 60 | |||
| 61 | 1 | public function withData(mixed $data): self |
|
| 67 | } |
||
| 68 | |||
| 69 | public function withMetadata(array $metadata): self |
||
| 75 | } |
||
| 76 | } |
||
| 77 |