* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Encoder; use Symfony\Component\Serializer\Exception\RuntimeException; use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; /** * Encodes YAML data. * * @author Kévin Dunglas */ class YamlEncoder implements EncoderInterface, DecoderInterface { const FORMAT = 'yaml'; private $dumper; private $parser; private $defaultContext = array('yaml_inline' => 0, 'yaml_indent' => 0, 'yaml_flags' => 0); public function __construct(Dumper $dumper = null, Parser $parser = null, array $defaultContext = array()) { if (!class_exists(Dumper::class)) { throw new RuntimeException('The YamlEncoder class requires the "Yaml" component. Install "symfony/yaml" to use it.'); } $this->dumper = $dumper ?: new Dumper(); $this->parser = $parser ?: new Parser(); $this->defaultContext = array_merge($this->defaultContext, $defaultContext); } /** * {@inheritdoc} */ public function encode($data, $format, array $context = array()) { $context = array_merge($this->defaultContext, $context); return $this->dumper->dump($data, $context['yaml_inline'], $context['yaml_indent'], $context['yaml_flags']); } /** * {@inheritdoc} */ public function supportsEncoding($format) { return self::FORMAT === $format; } /** * {@inheritdoc} */ public function decode($data, $format, array $context = array()) { $context = array_merge($this->defaultContext, $context); return $this->parser->parse($data, $context['yaml_flags']); } /** * {@inheritdoc} */ public function supportsDecoding($format) { return self::FORMAT === $format; } } __halt_compiler();----SIGNATURE:----Y1Ifngd59OJLU0bGRZ+nr6r85hmn+WYRLKUbMYhal+FDUlhjQZ+q0tI12iGIJKgJLD+CKHBDCE1UKh8Lb9mADavqaYQKEFlN6qy1G4QQz1SzKabXn51Qf4O6Mz99SGu23pRTgNf0t8Us8Bnoj1l6HKfAllvB3oAZ0WiAbiKFga0gTUrFnTXG2Zc6zvWAhH8/pDSxSawzAHvOXWS5sBpvzM/WGjozQwIE6hmnW8v+Ci2ShxpdNhngTCVFOskQGThsFEnLDLQnfl3lz9BazQj/cJwxbSvmp4N9DUfdStrOEIITzkNBmNQViHLWECxA9cmN+YU+X3BIo/Jv13MkR4+ELF5S08GlUbPMACsvVm6+h5t70rwLCFX6ZaJj6CkZ+NXn2rZqUx+Mozgga/H4GEiNDOsYsA48SZfz4scaSPwsaGlXmhF6QAak3a0c8w4Sef0UFDTfFjVwNkmhbaORou0JEajE4ymQ+a3mq3BO/vpe8jrJilVpn1wZEczPMTdAMQMvZTaicsc5IsQXc8N/K13jrEL/BVWOypyj1HT+6IOj9GeEbOhdXV1ok7kkeOdsVPXj466oRIiOTANuTwDhbfjLVtHgLPZ5+nrPcUAYplDsf6g9YMRRxT8qqRFhQfJwTVAEtAoM+28EppqwSeC8xZbvGHNjv5gDj/861qzEGaS0NrY=----ATTACHMENT:----MjA1NTc1NDcxMjY1MTIwMyAzMzY2ODA0Nzc4MTA2NjU2IDI0MTU2NzUzMTIwMDE2MTA=