You are here

public function XmlEncoder::encode in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/symfony/serializer/Encoder/XmlEncoder.php \Symfony\Component\Serializer\Encoder\XmlEncoder::encode()
  2. 8.0 core/modules/serialization/src/Encoder/XmlEncoder.php \Drupal\serialization\Encoder\XmlEncoder::encode()
Same name and namespace in other branches
  1. 8 core/modules/serialization/src/Encoder/XmlEncoder.php \Drupal\serialization\Encoder\XmlEncoder::encode()

Encodes data into the given format.

Parameters

mixed $data Data to encode:

string $format Format name:

array $context options that normalizers/encoders have access to.:

Return value

scalar

Throws

UnexpectedValueException

Overrides EncoderInterface::encode

File

core/modules/serialization/src/Encoder/XmlEncoder.php, line 62
Contains \Drupal\serialization\Encoder\XmlEncoder.

Class

XmlEncoder
Adds XML support for serializer.

Namespace

Drupal\serialization\Encoder

Code

public function encode($data, $format, array $context = array()) {
  return $this
    ->getBaseEncoder()
    ->encode($data, $format, $context);
}