public static function SerializationInterface::encode in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Component/Serialization/SerializationInterface.php \Drupal\Component\Serialization\SerializationInterface::encode()
Encodes data into the serialization format.
Parameters
mixed $data: The data to encode.
Return value
string The encoded data.
Throws
\Drupal\Component\Serialization\Exception\InvalidDataTypeException
7 methods override SerializationInterface::encode()
- Json::encode in core/
lib/ Drupal/ Component/ Serialization/ Json.php - Uses HTML-safe strings, with several characters escaped.
- PhpSerialize::encode in core/
lib/ Drupal/ Component/ Serialization/ PhpSerialize.php - Encodes data into the serialization format.
- Yaml::encode in core/
lib/ Drupal/ Component/ Serialization/ Yaml.php - Encodes data into the serialization format.
- YamlParserProxy::encode in core/
tests/ Drupal/ Tests/ Core/ Serialization/ YamlTest.php - Encodes data into the serialization format.
- YamlParserProxy::encode in core/
tests/ Drupal/ Tests/ Component/ Serialization/ YamlTest.php - Encodes data into the serialization format.
File
- core/
lib/ Drupal/ Component/ Serialization/ SerializationInterface.php, line 21
Class
- SerializationInterface
- Defines an interface for serialization formats.
Namespace
Drupal\Component\SerializationCode
public static function encode($data);