+ *
+ * @experimental in 4.2
+ */
+class PhpSerializer implements SerializerInterface
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function decode(array $encodedEnvelope): Envelope
+ {
+ if (empty($encodedEnvelope['body'])) {
+ throw new InvalidArgumentException('Encoded envelope should have at least a "body".');
+ }
+
+ return unserialize($encodedEnvelope['body']);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function encode(Envelope $envelope): array
+ {
+ return [
+ 'body' => serialize($envelope),
+ ];
+ }
+}
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy