You are here

interface EncoderInterface in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Encoder/EncoderInterface.php \Symfony\Component\Serializer\Encoder\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
Contains \Drupal\serialization\Encoder\JsonEncoder.
SerializationTestEncoder.php in core/modules/serialization/tests/serialization_test/src/SerializationTestEncoder.php
Contains \Drupal\serialization_test\SerializationTestEncoder.
Serializer.php in vendor/symfony/serializer/Serializer.php
XmlEncoder.php in core/modules/serialization/src/Encoder/XmlEncoder.php
Contains \Drupal\serialization\Encoder\XmlEncoder.

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

Namesort descending Modifiers Type Description Overrides
EncoderInterface::encode public function Encodes data into the given format. 7
EncoderInterface::supportsEncoding public function Checks whether the serializer can encode to given format. 7