From c470d8b273f098f29108d019deec3d29fb9a8400 Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Sun, 29 May 2011 10:58:32 +0200 Subject: [PATCH] moved the methods that can later be moved to a Builder to the bottom --- .../Component/Serializer/Serializer.php | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index 2e9c32479b..030b00d547 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -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)]); + } }