moved the methods that can later be moved to a Builder to the bottom

This commit is contained in:
Lukas Kahwe Smith 2011-05-29 10:58:32 +02:00
parent 5b3ccba2a1
commit c470d8b273

View File

@ -187,31 +187,17 @@ class Serializer implements SerializerInterface
/**
* {@inheritdoc}
*/
public function addNormalizer(NormalizerInterface $normalizer)
public function supportsSerialization($format)
{
$this->normalizers[] = $normalizer;
if ($normalizer instanceof SerializerAwareInterface) {
$normalizer->setSerializer($this);
}
return isset($this->encoders[$format]);
}
/**
* {@inheritdoc}
*/
public function removeNormalizer(NormalizerInterface $normalizer)
public function supportsDeserialization($format)
{
unset($this->normalizers[array_search($normalizer, $this->normalizers, true)]);
}
/**
* {@inheritdoc}
*/
public function setEncoder($format, EncoderInterface $encoder)
{
$this->encoders[$format] = $encoder;
if ($encoder instanceof SerializerAwareInterface) {
$encoder->setSerializer($this);
}
return isset($this->encoders[$format]) && $this->encoders[$format] instanceof DecoderInterface;
}
/**
@ -229,17 +215,12 @@ class Serializer implements SerializerInterface
/**
* {@inheritdoc}
*/
public function supportsSerialization($format)
public function setEncoder($format, EncoderInterface $encoder)
{
return isset($this->encoders[$format]);
}
/**
* {@inheritdoc}
*/
public function supportsDeserialization($format)
{
return isset($this->encoders[$format]) && $this->encoders[$format] instanceof DecoderInterface;
$this->encoders[$format] = $encoder;
if ($encoder instanceof SerializerAwareInterface) {
$encoder->setSerializer($this);
}
}
/**
@ -251,4 +232,23 @@ class Serializer implements SerializerInterface
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)]);
}
}