You are here

interface SerializationInterface in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Serialization/SerializationInterface.php \Drupal\Component\Serialization\SerializationInterface
  2. 9 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

7 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
FrontMatter.php in core/lib/Drupal/Component/FrontMatter/FrontMatter.php
KeyValueDatabaseExpirableFactory.php in core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php
KeyValueDatabaseFactory.php in core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseFactory.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