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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines the interface of serializers
|
|
|
|
*
|
|
|
|
* @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
|
|
|
|
* @param array $properties a list of properties to extract, if null all properties are returned
|
|
|
|
* @return array|scalar
|
2011-04-03 14:49:40 +01:00
|
|
|
* @api
|
2011-01-18 19:17:24 +00:00
|
|
|
*/
|
|
|
|
function normalize($object, $format, $properties = 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 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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether the given class is supported by this normalizer
|
|
|
|
*
|
|
|
|
* @param ReflectionClass $class
|
2011-04-23 16:05:44 +01:00
|
|
|
* @param string $format format the given data was extracted from
|
|
|
|
*
|
2011-01-18 19:17:24 +00:00
|
|
|
* @return Boolean
|
2011-04-23 16:05:44 +01:00
|
|
|
*
|
2011-04-03 14:49:40 +01:00
|
|
|
* @api
|
2011-01-18 19:17:24 +00:00
|
|
|
*/
|
|
|
|
function supports(\ReflectionClass $class, $format = null);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the owning Serializer object
|
|
|
|
*
|
|
|
|
* @param SerializerInterface $serializer
|
2011-04-03 14:49:40 +01:00
|
|
|
* @api
|
2011-01-18 19:17:24 +00:00
|
|
|
*/
|
|
|
|
function setSerializer(SerializerInterface $serializer);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the owning Serializer object
|
|
|
|
*
|
|
|
|
* @return SerializerInterface
|
2011-04-03 14:49:40 +01:00
|
|
|
* @api
|
2011-01-18 19:17:24 +00:00
|
|
|
*/
|
|
|
|
function getSerializer();
|
|
|
|
}
|