* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Extension\Core\DataTransformer; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; /** * Transforms between a timezone identifier string and a DateTimeZone object. * * @author Roland Franssen */ class DateTimeZoneToStringTransformer implements DataTransformerInterface { private $multiple; public function __construct($multiple = false) { $this->multiple = $multiple; } /** * {@inheritdoc} */ public function transform($dateTimeZone) { if (null === $dateTimeZone) { return; } if ($this->multiple) { if (!is_array($dateTimeZone)) { throw new TransformationFailedException('Expected an array.'); } return array_map(array(new self(), 'transform'), $dateTimeZone); } if (!$dateTimeZone instanceof \DateTimeZone) { throw new TransformationFailedException('Expected a \DateTimeZone.'); } return $dateTimeZone->getName(); } /** * {@inheritdoc} */ public function reverseTransform($value) { if (null === $value) { return; } if ($this->multiple) { if (!is_array($value)) { throw new TransformationFailedException('Expected an array.'); } return array_map(array(new self(), 'reverseTransform'), $value); } if (!is_string($value)) { throw new TransformationFailedException('Expected a string.'); } try { return new \DateTimeZone($value); } catch (\Exception $e) { throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); } } } __halt_compiler();----SIGNATURE:----MQIgkJyNDzqdEXlFEGAxjEAurK5PZuxRYNdnGkGIKmLmWCbXsfrpX1OPo8y5A1WaGvZrC0Dd02tcVL4zy5CV3du7lDoe9niBzNOSdtJooaMO1zm+/1mu/q/wumWvm8+yuaKlk4/PI4NpztjneeC+3Zs929E6Cns8IjZiK3ix/RV/cTajrz7WwOod+dFBCfiurI5FOodOpgER6wHB+M051+/XrvpEB5BVD3gH4Q7Cpe4+x1XZu1vSjy3+fX69gn4tw+35Qq+frvfgqkKoaFbeEqtIsjNdp9cZBS8oYv0fe+Ak+AoeRQeVREIPhSeVBnw7Oq7W4bRfRdUoAvzVS03K5vigz9FLHUgEci9GEKODdophbsFLVwbtVhVMhPYmsjxLlgmauNKtMvWZwhJfijIsqCLBhyaiKmvs7N5nArPP6sdC+Kx3sar+0ek67MKpOHw1guHTNi0MrHN5p+QB1Z0y95zmn8kwVEDszQ+JzTQaCm2e5RP2wkf89bPaS/Uih1gmb3aSXHN8ldXxY9kK6iNKtcsbEID78jzYQzztpD+WvOS2rYJUyiZMmGRsS0oYNjhVaNjLnnPLe+n9Ah9Nf6h4x6QOMe3FlWkgzgc9c/WTQJAZ+3zhbgwoUOEmRUox7kGzfgfzDT0r7ROBNp27CdM2krBwWMWzkyBm3R+Cwxiqft8=----ATTACHMENT:----ODI4NDgwNjk2ODAxMzM1MiA1NDQ2MDYxMjU4MDMxMjQgNTE5Njc2Mzc2NTkxODYyMA==