vendor/symfony/form/CallbackTransformer.php line 34

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Form;
  11. class CallbackTransformer implements DataTransformerInterface
  12. {
  13.     private $transform;
  14.     private $reverseTransform;
  15.     /**
  16.      * @param callable $transform        The forward transform callback
  17.      * @param callable $reverseTransform The reverse transform callback
  18.      */
  19.     public function __construct(callable $transform, callable $reverseTransform)
  20.     {
  21.         $this->transform $transform;
  22.         $this->reverseTransform $reverseTransform;
  23.     }
  24.     /**
  25.      * {@inheritdoc}
  26.      */
  27.     public function transform($data)
  28.     {
  29.         return ($this->transform)($data);
  30.     }
  31.     /**
  32.      * {@inheritdoc}
  33.      */
  34.     public function reverseTransform($data)
  35.     {
  36.         return ($this->reverseTransform)($data);
  37.     }
  38. }