* * 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:----DPjCd1W8WaKPpwW+bhz6tLkmmDI+V7WnPXTTRu0Q9APF2OGL9rSFyXClFv0DL80RRoKhsuMcOknyYL8exckydu4GTmCmm+OYEZ6M0S7P8RRtGtyYbiSgUURIYmjWyluugglIhfW4fihfFxL9pT+MNQzxhGxNAYelDKRGfyfnOgPQ1Q++KDKZId7LQbUuwsHjIjMtG1eriku2D2Q9t89X5G1JPfFMUCWJqMtKZog3wuYXhcaLMD+ay9pjjqXJ+ngV4W5EuxpR8cus4muM4KtWenRId/Ak50CN8C1gGojmNc5W86NmDhpDD5iVgNKhGBf6GqZ+e6jNGeaIr85oqpzNlGdFaF1m1J0uayp4gGG7a1QWhYW6zRrN0Wf2Fo04AVMUSLoNzeLJ+P3gHfOsbARQQ2ZXrLQWR6+7dqhvh/4dXgd1wJeFFjJQ2MOljoQAq7JD+BBasig/iK7K8pWaTZqsjreD/G8YXWMph14f0SI85Z0+Hocw2yw/lxxxavzUj3rV925hHZhjdV78HAwPP3VmnOoTxEajRbxq46WjnxN4v+frmJfWjNuYlYlDKDH99tg8U86SYGCkLR+xUmQENJjbWFcmsCpdqg9gypSfCJOp6mURrCQxgDxYd1OXBLvJDAEVaSTXhkF/MQkVgjA+dUGQBXcAjdA73O/RUHEjpTKZfCk=----ATTACHMENT:----NTU4ODA2MTc0NDI3OTM2NiAzNzA4NjQxODc0MjAxNDg0IDg4NjgyODI4MzU3NDI0Mjk=