Serializes data in the appropriate format
mixed $data any data:
string $format format name:
string
Overrides SerializerInterface::serialize
public final function serialize($data, $format) {
if (!$this
->supportsEncoding($format)) {
throw new UnexpectedValueException('Serialization for the format ' . $format . ' is not supported');
}
if ($this->encoder
->needsNormalization($format)) {
$data = $this
->normalize($data, $format);
}
return $this
->encode($data, $format);
}