]> git.immae.eu Git - github/wallabag/wallabag.git/blame - vendor/symfony/form/Symfony/Component/Form/ReversedTransformer.php
gitignore vendor
[github/wallabag/wallabag.git] / vendor / symfony / form / Symfony / Component / Form / ReversedTransformer.php
CommitLineData
4f5b44bd
NL
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * Reverses a transformer
16 *
17 * When the transform() method is called, the reversed transformer's
18 * reverseTransform() method is called and vice versa.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class ReversedTransformer implements DataTransformerInterface
23{
24 /**
25 * The reversed transformer
26 * @var DataTransformerInterface
27 */
28 protected $reversedTransformer;
29
30 /**
31 * Reverses this transformer
32 *
33 * @param DataTransformerInterface $reversedTransformer
34 */
35 public function __construct(DataTransformerInterface $reversedTransformer)
36 {
37 $this->reversedTransformer = $reversedTransformer;
38 }
39
40 /**
41 * {@inheritDoc}
42 */
43 public function transform($value)
44 {
45 return $this->reversedTransformer->reverseTransform($value);
46 }
47
48 /**
49 * {@inheritDoc}
50 */
51 public function reverseTransform($value)
52 {
53 return $this->reversedTransformer->transform($value);
54 }
55}