Ejemplo n.º 1
0
 /**
  * @param PayloadInterface $payload
  *
  * @return array The serialized payload data
  */
 public function serialize(PayloadInterface $payload)
 {
     if ($payload instanceof AdvancedSerializeInterface) {
         $payload->beforeSerialize($this->serializer);
     }
     $serializedPayload = $this->serializer->serialize($payload, 'json');
     if (!$serializedPayload || !is_string($serializedPayload)) {
         throw new \RuntimeException(sprintf('Failed to serialize payload; expected it to be a string, got: %s', var_export($serializedPayload, true)));
     }
     return json_decode($serializedPayload, true);
 }