Bläddra i källkod

[Serializer] add methods to the SerializerInterface

Jordi Boggiano 14 år sedan
förälder
incheckning
76cab7deb9

+ 9 - 0
src/Symfony/Component/Serializer/Serializer.php

@@ -131,17 +131,26 @@ class Serializer implements SerializerInterface
         return $this->encoders[$format]->decode($data, $format);
     }
 
+    /**
+     * {@inheritdoc}
+     */
     public function addNormalizer(NormalizerInterface $normalizer)
     {
         $this->normalizers[] = $normalizer;
         $normalizer->setSerializer($this);
     }
 
+    /**
+     * {@inheritdoc}
+     */
     public function getNormalizers()
     {
         return $this->normalizers;
     }
 
+    /**
+     * {@inheritdoc}
+     */
     public function removeNormalizer(NormalizerInterface $normalizer)
     {
         unset($this->normalizers[array_search($normalizer, $this->normalizers, true)]);

+ 17 - 0
src/Symfony/Component/Serializer/SerializerInterface.php

@@ -3,6 +3,7 @@
 namespace Symfony\Component\Serializer;
 
 use Symfony\Component\Serializer\Encoder\EncoderInterface;
+use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
 
 /*
  * This file is part of the Symfony framework.
@@ -76,6 +77,22 @@ interface SerializerInterface
      */
     function decode($data, $format);
 
+
+    /**
+     * @param NormalizerInterface $normalizer
+     */
+    function addNormalizer(NormalizerInterface $normalizer);
+
+    /**
+     * @return array[]NormalizerInterface
+     */
+    function getNormalizers();
+
+    /**
+     * @param NormalizerInterface $normalizer
+     */
+    function removeNormalizer(NormalizerInterface $normalizer);
+
     /**
      * @param string $format format name
      * @param EncoderInterface $encoder