You are here

final public function Serializer::encode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Serializer.php \Symfony\Component\Serializer\Serializer::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

1 call to Serializer::encode()
Serializer::serialize in vendor/symfony/serializer/Serializer.php
Serializes data in the appropriate format.

File

vendor/symfony/serializer/Serializer.php, line 233

Class

Serializer
Serializer serializes and deserializes data.

Namespace

Symfony\Component\Serializer

Code

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