|
@@ -32,34 +32,34 @@ interface SerializerInterface
|
|
|
function serialize($data, $format);
|
|
|
|
|
|
/**
|
|
|
- * Normalizes any data into a set of arrays/scalars
|
|
|
+ * Deserializes data into the given type.
|
|
|
*
|
|
|
- * @param mixed $data data to normalize
|
|
|
- * @param string $format format name, present to give the option to normalizers to act differently based on formats
|
|
|
- * @return array|scalar
|
|
|
- * @api
|
|
|
+ * @param mixed $data
|
|
|
+ * @param string $type
|
|
|
+ * @param string $format
|
|
|
*/
|
|
|
- function normalize($data, $format);
|
|
|
+ function deserialize($data, $type, $format);
|
|
|
|
|
|
/**
|
|
|
- * Normalizes an object into a set of arrays/scalars
|
|
|
+ * Normalizes any data into a set of arrays/scalars
|
|
|
*
|
|
|
- * @param object $object object to normalize
|
|
|
+ * @param mixed $data data to normalize
|
|
|
* @param string $format format name, present to give the option to normalizers to act differently based on formats
|
|
|
- * @param array $properties a list of properties to extract, if null all properties are returned
|
|
|
* @return array|scalar
|
|
|
+ * @api
|
|
|
*/
|
|
|
- function normalizeObject($object, $format, $properties = null);
|
|
|
+ function normalize($data, $format = null);
|
|
|
|
|
|
/**
|
|
|
- * Denormalizes data back into an object of the given class
|
|
|
+ * Denormalizes data into the given type.
|
|
|
*
|
|
|
- * @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
|
|
|
+ * @param mixed $data
|
|
|
+ * @param string $type
|
|
|
+ * @param string $format
|
|
|
+ *
|
|
|
+ * @return mixed
|
|
|
*/
|
|
|
- function denormalizeObject($data, $class, $format = null);
|
|
|
+ function denormalize($data, $type, $format = null);
|
|
|
|
|
|
/**
|
|
|
* Encodes data into the given format
|
|
@@ -80,48 +80,4 @@ interface SerializerInterface
|
|
|
* @api
|
|
|
*/
|
|
|
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
|
|
|
- */
|
|
|
- function setEncoder($format, EncoderInterface $encoder);
|
|
|
-
|
|
|
- /**
|
|
|
- * @return EncoderInterface
|
|
|
- */
|
|
|
- function getEncoders();
|
|
|
-
|
|
|
- /**
|
|
|
- * @return array[]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);
|
|
|
-
|
|
|
- /**
|
|
|
- * @param string $format format name
|
|
|
- */
|
|
|
- function removeEncoder($format);
|
|
|
}
|