You are here

interface SerializationInterface in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Component/Serialization/SerializationInterface.php \Drupal\Component\Serialization\SerializationInterface
  2. 10 core/lib/Drupal/Component/Serialization/SerializationInterface.php \Drupal\Component\Serialization\SerializationInterface

Defines an interface for serialization formats.

Hierarchy

Expanded class hierarchy of SerializationInterface

All classes that implement SerializationInterface

6 files declare their use of SerializationInterface
DatabaseStorage.php in core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php
DatabaseStorageExpirable.php in core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php
KeyValueDatabaseExpirableFactory.php in core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php
KeyValueDatabaseFactory.php in core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseFactory.php
YamlTest.php in core/tests/Drupal/Tests/Core/Serialization/YamlTest.php

... See full list

File

core/lib/Drupal/Component/Serialization/SerializationInterface.php, line 8

Namespace

Drupal\Component\Serialization
View source
interface SerializationInterface {

  /**
   * Encodes data into the serialization format.
   *
   * @param mixed $data
   *   The data to encode.
   *
   * @return string
   *   The encoded data.
   *
   * @throws \Drupal\Component\Serialization\Exception\InvalidDataTypeException
   */
  public static function encode($data);

  /**
   * Decodes data from the serialization format.
   *
   * @param string $raw
   *   The raw data string to decode.
   *
   * @return mixed
   *   The decoded data.
   *
   * @throws \Drupal\Component\Serialization\Exception\InvalidDataTypeException
   */
  public static function decode($raw);

  /**
   * Gets the file extension for this serialization format.
   *
   * @return string
   *   The file extension, without leading dot.
   */
  public static function getFileExtension();

}

Members

Namesort descending Modifiers Type Description Overrides
SerializationInterface::decode public static function Decodes data from the serialization format. 7
SerializationInterface::encode public static function Encodes data into the serialization format. 7
SerializationInterface::getFileExtension public static function Gets the file extension for this serialization format. 7