public function Serializer::__construct in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/serializer/Serializer.php \Symfony\Component\Serializer\Serializer::__construct()
- 8 vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock/Serializer.php \phpDocumentor\Reflection\DocBlock\Serializer::__construct()
- 8 core/modules/rest/src/Plugin/views/style/Serializer.php \Drupal\rest\Plugin\views\style\Serializer::__construct()
Same name and namespace in other branches
- 8.0 vendor/symfony/serializer/Serializer.php \Symfony\Component\Serializer\Serializer::__construct()
File
- vendor/
symfony/ serializer/ Serializer.php, line 61
Class
- Serializer
- Serializer serializes and deserializes data.
Namespace
Symfony\Component\SerializerCode
public function __construct(array $normalizers = array(), array $encoders = array()) {
foreach ($normalizers as $normalizer) {
if ($normalizer instanceof SerializerAwareInterface) {
$normalizer
->setSerializer($this);
}
}
$this->normalizers = $normalizers;
$decoders = array();
$realEncoders = array();
foreach ($encoders as $encoder) {
if ($encoder instanceof SerializerAwareInterface) {
$encoder
->setSerializer($this);
}
if ($encoder instanceof DecoderInterface) {
$decoders[] = $encoder;
}
if ($encoder instanceof EncoderInterface) {
$realEncoders[] = $encoder;
}
}
$this->encoder = new ChainEncoder($realEncoders);
$this->decoder = new ChainDecoder($decoders);
}