2011-01-18 19:17:24 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Symfony\Component\Serializer\Normalizer;
|
|
|
|
|
|
|
|
use Symfony\Component\Serializer\SerializerInterface;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of the Symfony framework.
|
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
2011-01-18 19:17:24 +00:00
|
|
|
*
|
|
|
|
* This source file is subject to the MIT license that is bundled
|
|
|
|
* with this source code in the file LICENSE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2011-05-06 18:04:22 +01:00
|
|
|
* Defines the interface of normalizers.
|
2011-01-18 19:17:24 +00:00
|
|
|
*
|
|
|
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
|
|
|
*/
|
|
|
|
interface NormalizerInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Normalizes an object into a set of arrays/scalars
|
|
|
|
*
|
|
|
|
* @param object $object object to normalize
|
|
|
|
* @param string $format format the normalization result will be encoded as
|
|
|
|
* @return array|scalar
|
2011-04-03 14:49:40 +01:00
|
|
|
* @api
|
2011-01-18 19:17:24 +00:00
|
|
|
*/
|
2011-05-08 17:32:22 +01:00
|
|
|
function normalize($object, $format);
|
2011-01-18 19:17:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 the given data was extracted from
|
|
|
|
* @return object
|
2011-04-03 14:49:40 +01:00
|
|
|
* @api
|
2011-01-18 19:17:24 +00:00
|
|
|
*/
|
|
|
|
function denormalize($data, $class, $format = null);
|
|
|
|
|
|
|
|
/**
|
2011-05-06 18:36:56 +01:00
|
|
|
* Checks whether the given class is supported for normalization by this normalizer
|
2011-04-23 16:05:44 +01:00
|
|
|
*
|
2011-05-06 18:36:56 +01:00
|
|
|
* @param mixed $data Data to normalize.
|
|
|
|
* @param string $format The format being (de-)serialized from or into.
|
2011-01-18 19:17:24 +00:00
|
|
|
* @return Boolean
|
2011-05-06 18:36:56 +01:00
|
|
|
* @api
|
|
|
|
*/
|
|
|
|
function supportsNormalization($data, $format = null);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether the given class is supported for denormalization by this normalizer
|
2011-04-23 16:05:44 +01:00
|
|
|
*
|
2011-05-06 18:36:56 +01:00
|
|
|
* @param mixed $data Data to denormalize from.
|
|
|
|
* @param string $type The class to which the data should be denormalized.
|
|
|
|
* @param string $format The format being deserialized from.
|
|
|
|
* @return Boolean
|
2011-04-03 14:49:40 +01:00
|
|
|
* @api
|
2011-01-18 19:17:24 +00:00
|
|
|
*/
|
2011-05-06 18:36:56 +01:00
|
|
|
function supportsDenormalization($data, $type, $format = null);
|
2011-01-18 19:17:24 +00:00
|
|
|
}
|