|
@@ -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);
|
|
|
}
|