2010-06-24 09:40:05 +01:00
|
|
|
<?php
|
|
|
|
|
2010-08-20 22:09:55 +01:00
|
|
|
namespace Symfony\Component\Form\ValueTransformer;
|
2010-06-24 09:40:05 +01:00
|
|
|
|
2010-10-02 11:38:11 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the Symfony framework.
|
|
|
|
*
|
|
|
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
|
*
|
|
|
|
* This source file is subject to the MIT license that is bundled
|
|
|
|
* with this source code in the file LICENSE.
|
|
|
|
*/
|
|
|
|
|
2010-08-20 22:09:55 +01:00
|
|
|
use Symfony\Component\Form\Localizable;
|
2010-06-24 09:40:05 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Transforms a value between different representations.
|
|
|
|
*
|
|
|
|
* @author Bernhard Schussek <bernhard.schussek@symfony-project.com>
|
|
|
|
*/
|
|
|
|
interface ValueTransformerInterface extends Localizable
|
|
|
|
{
|
2010-06-24 10:24:08 +01:00
|
|
|
/**
|
|
|
|
* Transforms a value from the original representation to a transformed
|
|
|
|
* representation.
|
|
|
|
*
|
|
|
|
* @param mixed $value The value in the original representation
|
|
|
|
* @return mixed The value in the transformed representation
|
|
|
|
* @throws InvalidArgument Exception when the argument is no string
|
|
|
|
* @throws ValueTransformer Exception when the transformation fails
|
|
|
|
*/
|
|
|
|
public function transform($value);
|
2010-06-24 09:40:05 +01:00
|
|
|
|
2010-06-24 10:24:08 +01:00
|
|
|
/**
|
|
|
|
* Transforms a value from the transformed representation to its original
|
|
|
|
* representation.
|
|
|
|
*
|
|
|
|
* This method must be able to deal with null values.
|
|
|
|
*
|
|
|
|
* @param mixed $value The value in the transformed representation
|
|
|
|
* @return mixed The value in the original representation
|
|
|
|
* @throws InvalidArgument Exception when the argument is not of the
|
|
|
|
* expected type
|
|
|
|
* @throws ValueTransformer Exception when the transformation fails
|
|
|
|
*/
|
|
|
|
public function reverseTransform($value);
|
2010-06-24 09:40:05 +01:00
|
|
|
}
|