Total Complexity | 7 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Coverage | 65.38% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait EnvelopeTrait |
||
8 | { |
||
9 | private MessageInterface $message; |
||
10 | |||
11 | /** |
||
12 | * A mirror of {@see MessageInterface::fromData()} |
||
13 | */ |
||
14 | abstract public static function fromMessage(MessageInterface $message): self; |
||
15 | |||
16 | public static function fromData(string $handlerName, mixed $data, array $metadata = []): MessageInterface |
||
17 | { |
||
18 | $message = new Message($handlerName, $data, $metadata); |
||
19 | |||
20 | return self::fromMessage($message); |
||
|
|||
21 | } |
||
22 | |||
23 | 5 | public function getMessage(): MessageInterface |
|
24 | { |
||
25 | 5 | return $this->message; |
|
26 | } |
||
27 | |||
28 | public function withMessage(MessageInterface $message): self |
||
34 | } |
||
35 | |||
36 | 9 | public function getHandlerName(): string |
|
37 | { |
||
38 | 9 | return $this->message->getHandlerName(); |
|
39 | } |
||
40 | |||
41 | 5 | public function getData(): mixed |
|
44 | } |
||
45 | |||
46 | 13 | public function getMetadata(): array |
|
57 | 13 | ); |
|
58 | } |
||
59 | |||
60 | public function getEnvelopeMetadata(): array |
||
65 |