interface SerializationInterface

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

5 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

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

Title Sort descending Modifiers Object type Summary Overrides
SerializationInterface::decode public static function Decodes data from the serialization format. 4
SerializationInterface::encode public static function Encodes data into the serialization format. 4
SerializationInterface::getFileExtension public static function Gets the file extension for this serialization format. 4

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.