1. 8.2.x vendor/symfony/serializer/Encoder/EncoderInterface.php EncoderInterface
  2. 8.0.x vendor/symfony/serializer/Encoder/EncoderInterface.php EncoderInterface
  3. 8.1.x vendor/symfony/serializer/Encoder/EncoderInterface.php EncoderInterface
  4. 8.3.x vendor/symfony/serializer/Encoder/EncoderInterface.php EncoderInterface

Defines the interface of encoders.

@author Jordi Boggiano <j.boggiano@seld.be>

Hierarchy

Expanded class hierarchy of EncoderInterface

All classes that implement EncoderInterface

4 files declare their use of EncoderInterface
JsonEncoder.php in core/modules/serialization/src/Encoder/JsonEncoder.php
SerializationTestEncoder.php in core/modules/serialization/tests/serialization_test/src/SerializationTestEncoder.php
Serializer.php in vendor/symfony/serializer/Serializer.php
XmlEncoder.php in core/modules/serialization/src/Encoder/XmlEncoder.php

File

vendor/symfony/serializer/Encoder/EncoderInterface.php, line 21

Namespace

Symfony\Component\Serializer\Encoder
View source
interface EncoderInterface
 {
  /**
   * Encodes data into the given format.
   *
   * @param mixed  $data    Data to encode
   * @param string $format  Format name
   * @param array  $context options that normalizers/encoders have access to
   *
   * @return scalar
   *
   * @throws UnexpectedValueException
   */
  public function encode($data, $format, array $context = array());

  /**
   * Checks whether the serializer can encode to given format.
   *
   * @param string $format format name
   *
   * @return bool
   */
  public function supportsEncoding($format);
}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
EncoderInterface::encode public function Encodes data into the given format.
EncoderInterface::supportsEncoding public function Checks whether the serializer can encode to given format.