Browse Source

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

Lukas Kahwe Smith 14 years ago
parent
commit
c470d8b273
1 changed files with 24 additions and 24 deletions
  1. 24 24
      src/Symfony/Component/Serializer/Serializer.php

+ 24 - 24
src/Symfony/Component/Serializer/Serializer.php

@@ -187,68 +187,68 @@ 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)]);
+        return isset($this->encoders[$format]) && $this->encoders[$format] instanceof DecoderInterface;
     }
 
     /**
      * {@inheritdoc}
      */
-    public function setEncoder($format, EncoderInterface $encoder)
+    public function getEncoder($format)
     {
-        $this->encoders[$format] = $encoder;
-        if ($encoder instanceof SerializerAwareInterface) {
-            $encoder->setSerializer($this);
+        if (!isset($this->encoders[$format])) {
+            throw new RuntimeException(sprintf('No encoder found for format "%s".', $format));
         }
+
+        return $this->encoders[$format];
     }
 
     /**
      * {@inheritdoc}
      */
-    public function getEncoder($format)
+    public function setEncoder($format, EncoderInterface $encoder)
     {
-        if (!isset($this->encoders[$format])) {
-            throw new RuntimeException(sprintf('No encoder found for format "%s".', $format));
+        $this->encoders[$format] = $encoder;
+        if ($encoder instanceof SerializerAwareInterface) {
+            $encoder->setSerializer($this);
         }
-
-        return $this->encoders[$format];
     }
 
     /**
      * {@inheritdoc}
      */
-    public function supportsSerialization($format)
+    public function removeEncoder($format)
     {
-        return isset($this->encoders[$format]);
+        if (isset($this->encoders[$format])) {
+            unset($this->encoders[$format]);
+        }
     }
 
     /**
      * {@inheritdoc}
      */
-    public function supportsDeserialization($format)
+    public function addNormalizer(NormalizerInterface $normalizer)
     {
-        return isset($this->encoders[$format]) && $this->encoders[$format] instanceof DecoderInterface;
+        $this->normalizers[] = $normalizer;
+        if ($normalizer instanceof SerializerAwareInterface) {
+            $normalizer->setSerializer($this);
+        }
     }
 
     /**
      * {@inheritdoc}
      */
-    public function removeEncoder($format)
+    public function removeNormalizer(NormalizerInterface $normalizer)
     {
-        if (isset($this->encoders[$format])) {
-            unset($this->encoders[$format]);
-        }
+        unset($this->normalizers[array_search($normalizer, $this->normalizers, true)]);
     }
 }