فهرست منبع

expand interface

actually the main methods I am looking for is hasDecoder() and getEncoder() to be able to check if there is a Decoder to decode the Request body as well as if the encoder implements the TemplatingAwareInterface
Lukas Kahwe Smith 14 سال پیش
والد
کامیت
34b5a67987
1فایلهای تغییر یافته به همراه64 افزوده شده و 1 حذف شده
  1. 64 1
      src/Symfony/Component/Serializer/SerializerInterface.php

+ 64 - 1
src/Symfony/Component/Serializer/SerializerInterface.php

@@ -2,8 +2,10 @@
 
 namespace Symfony\Component\Serializer;
 
-use Symfony\Component\Serializer\Encoder\EncoderInterface;
 use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
+use Symfony\Component\Serializer\Encoder\EncoderInterface;
+use Symfony\Component\Serializer\Encoder\DecoderInterface;
+use Symfony\Component\Serializer\Encoder\NormalizationAwareInterface;
 
 /*
  * This file is part of the Symfony framework.
@@ -80,4 +82,65 @@ interface SerializerInterface
      * @api
      */
     function decode($data, $format);
+
+    /**
+     * Normalizes an object into a set of arrays/scalars
+     *
+     * @param object $object object to normalize
+     * @param string $format format name, present to give the option to normalizers to act differently based on formats
+     * @return array|scalar
+     */
+    function normalizeObject($object, $format = null);
+
+    /**
+     * Denormalizes data back into an object of the given class
+     *
+     * @param mixed $data data to restore
+     * @param string $class the expected class to instantiate
+     * @param string $format format name, present to give the option to normalizers to act differently based on formats
+     * @return object
+     */
+    function denormalizeObject($data, $class, $format = null);
+
+    /**
+     * @param NormalizerInterface $normalizer
+     */
+    function addNormalizer(NormalizerInterface $normalizer);
+
+    /**
+     * @param NormalizerInterface $normalizer
+     */
+    function removeNormalizer(NormalizerInterface $normalizer);
+
+    /**
+     * @param string           $format  format name
+     * @param EncoderInterface $encoder
+     */
+    function setEncoder($format, EncoderInterface $encoder);
+
+    /**
+     * @return EncoderInterface
+     */
+    function getEncoder($format);
+
+    /**
+     * Checks whether the serializer has an encoder registered for the given format
+     *
+     * @param string $format format name
+     * @return Boolean
+     */
+    function hasEncoder($format);
+
+    /**
+     * Checks whether the serializer has a decoder registered for the given format
+     *
+     * @param string $format format name
+     * @return Boolean
+     */
+    function hasDecoder($format);
+
+    /**
+     * @param string $format format name
+     */
+    function removeEncoder($format);
 }