moved the methods that can later be moved to a Builder to the bottom
This commit is contained in:
parent
5b3ccba2a1
commit
c470d8b273
@ -187,31 +187,17 @@ class Serializer implements SerializerInterface
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function addNormalizer(NormalizerInterface $normalizer)
|
public function supportsSerialization($format)
|
||||||
{
|
{
|
||||||
$this->normalizers[] = $normalizer;
|
return isset($this->encoders[$format]);
|
||||||
if ($normalizer instanceof SerializerAwareInterface) {
|
|
||||||
$normalizer->setSerializer($this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function removeNormalizer(NormalizerInterface $normalizer)
|
public function supportsDeserialization($format)
|
||||||
{
|
{
|
||||||
unset($this->normalizers[array_search($normalizer, $this->normalizers, true)]);
|
return isset($this->encoders[$format]) && $this->encoders[$format] instanceof DecoderInterface;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function setEncoder($format, EncoderInterface $encoder)
|
|
||||||
{
|
|
||||||
$this->encoders[$format] = $encoder;
|
|
||||||
if ($encoder instanceof SerializerAwareInterface) {
|
|
||||||
$encoder->setSerializer($this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -229,17 +215,12 @@ class Serializer implements SerializerInterface
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function supportsSerialization($format)
|
public function setEncoder($format, EncoderInterface $encoder)
|
||||||
{
|
{
|
||||||
return isset($this->encoders[$format]);
|
$this->encoders[$format] = $encoder;
|
||||||
}
|
if ($encoder instanceof SerializerAwareInterface) {
|
||||||
|
$encoder->setSerializer($this);
|
||||||
/**
|
}
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function supportsDeserialization($format)
|
|
||||||
{
|
|
||||||
return isset($this->encoders[$format]) && $this->encoders[$format] instanceof DecoderInterface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -251,4 +232,23 @@ class Serializer implements SerializerInterface
|
|||||||
unset($this->encoders[$format]);
|
unset($this->encoders[$format]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function addNormalizer(NormalizerInterface $normalizer)
|
||||||
|
{
|
||||||
|
$this->normalizers[] = $normalizer;
|
||||||
|
if ($normalizer instanceof SerializerAwareInterface) {
|
||||||
|
$normalizer->setSerializer($this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function removeNormalizer(NormalizerInterface $normalizer)
|
||||||
|
{
|
||||||
|
unset($this->normalizers[array_search($normalizer, $this->normalizers, true)]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user