File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77abstract class Envelope implements EnvelopeInterface
88{
9+ private ?array $ metadata = null ;
10+
911 public function __construct (protected MessageInterface $ message )
1012 {
1113 }
@@ -34,16 +36,20 @@ public function getData(): mixed
3436
3537 public function getMetadata (): array
3638 {
37- return array_merge (
38- $ this ->message ->getMetadata (),
39- [
40- EnvelopeInterface::ENVELOPE_STACK_KEY => array_merge (
41- $ this ->message ->getMetadata ()[EnvelopeInterface::ENVELOPE_STACK_KEY ] ?? [],
42- [static ::class],
43- ),
44- ],
45- $ this ->getEnvelopeMetadata (),
46- );
39+ if ($ this ->metadata === null ) {
40+ $ this ->metadata = array_merge (
41+ $ this ->message ->getMetadata (),
42+ [
43+ EnvelopeInterface::ENVELOPE_STACK_KEY => array_merge (
44+ $ this ->message ->getMetadata ()[EnvelopeInterface::ENVELOPE_STACK_KEY ] ?? [],
45+ [static ::class],
46+ ),
47+ ],
48+ $ this ->getEnvelopeMetadata (),
49+ );
50+ }
51+
52+ return $ this ->metadata ;
4753 }
4854
4955 abstract protected function getEnvelopeMetadata (): array ;
You can’t perform that action at this time.
0 commit comments