You are here

public function XmlEncoder::encode in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/serialization/src/Encoder/XmlEncoder.php \Drupal\serialization\Encoder\XmlEncoder::encode()
  2. 9 core/modules/serialization/src/Encoder/XmlEncoder.php \Drupal\serialization\Encoder\XmlEncoder::encode()

File

core/modules/serialization/src/Encoder/XmlEncoder.php, line 67

Class

XmlEncoder
Adds XML support for serializer.

Namespace

Drupal\serialization\Encoder

Code

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