You are here

final public function ChainEncoder::encode in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/serializer/Encoder/ChainEncoder.php \Symfony\Component\Serializer\Encoder\ChainEncoder::encode()

Encodes data into the given format.

Parameters

mixed $data Data to encode:

string $format Format name:

array $context options that normalizers/encoders have access to.:

Return value

scalar

Throws

UnexpectedValueException

Overrides EncoderInterface::encode

File

vendor/symfony/serializer/Encoder/ChainEncoder.php, line 36

Class

ChainEncoder
Encoder delegating the decoding to a chain of encoders.

Namespace

Symfony\Component\Serializer\Encoder

Code

public final function encode($data, $format, array $context = array()) {
  return $this
    ->getEncoder($format)
    ->encode($data, $format, $context);
}