public function decode(array
$encodedEnvelope): Envelope
{ if (empty($encodedEnvelope['body'
]) ||
empty($encodedEnvelope['headers'
])) { throw new MessageDecodingFailedException('Encoded envelope should have at least a "body" and some "headers", or maybe you should implement your own serializer.'
);
} if (empty($encodedEnvelope['headers'
]['type'
])) { throw new MessageDecodingFailedException('Encoded envelope does not have a "type" header.'
);
} $stamps =
$this->
decodeStamps($encodedEnvelope);
$stamps[] =
new SerializedMessageStamp($encodedEnvelope['body'
]);
$serializerStamp =
$this->
findFirstSerializerStamp($stamps);
$context =
$this->context;
if (null !==
$serializerStamp) { $context =
$serializerStamp->
getContext() +
$context;
} try { $message =
$this->serializer->
deserialize($encodedEnvelope['body'
],
$encodedEnvelope['headers'
]['type'
],
$this->format,
$context);
}