* * 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\NotEncodableValueException; /** * Encodes JSON data. * * @author Sander Coolen */ class JsonEncode implements EncoderInterface { private $options; public function __construct($bitmask = 0) { $this->options = $bitmask; } /** * Encodes PHP data to a JSON string. * * {@inheritdoc} */ public function encode($data, $format, array $context = array()) { $context = $this->resolveContext($context); $encodedJson = json_encode($data, $context['json_encode_options']); if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($context['json_encode_options'] & JSON_PARTIAL_OUTPUT_ON_ERROR))) { throw new NotEncodableValueException(json_last_error_msg()); } return $encodedJson; } /** * {@inheritdoc} */ public function supportsEncoding($format) { return JsonEncoder::FORMAT === $format; } /** * Merge default json encode options with context. * * @return array */ private function resolveContext(array $context = array()) { return array_merge(array('json_encode_options' => $this->options), $context); } } __halt_compiler();----SIGNATURE:----NgX+8jhn6Fhbf76OdtANvoKm56uwtCUwfi5oeln9pPBrwy17T+vn7AJc0AA9EaIkNUoo344kndWLTkvLWYX9OE6M4GOb69gFDwevYL98fzkZe9hOxueC4b9Pz0sgwNkcwlF6ZiKfLyt/q+0mpEykENqjR2/U4LCDMwLSM2PSQMi9FzNruGlAnheZJn6bU488TrXLpD5CDCGR9WGBCs8Jf432Osgb841Pi20wMrmCTPAvQ8y7FpMJjrttlUpo43PwqC0yZKF9gRjOAEeHrXBktz3hLEm7twaUYx0JRy0T8MsnbFMynjyIEGF4kFgSZyxTUi/acBUKUxLqroCXs78CA2aIQMce1eX0hxEVfUW9x5Z4v1yOY57IqUN56+5CLuJ4JPknHko+Ee/MawXxQbogfINJOIICXiQ+8RdPKxqYVxIFhS/4ySbM2c5DDYBK3IJx2fYc11Q9t5k6Rr4Jy9hDjcyhXwc/uoQCahkKaxfwm/Fckq2SaCAfiI8fCpin3lF9njM2lL9KZepjDtV/HXsRyVpETKhYSGE/RcxtuCrXPIrsyU/UdD2mGWv820Imidr0xbMY46LxnHObAna/aEi9DzsWOUA/PkXKraR2vVperPY8Juqp3rwNZh/a0Y5iR+xGS13CPim1wDENWeryYfkQOlTSVSD4HgQZbaqp8/p31fI=----ATTACHMENT:----NDA0NjM2Mzg4NzU5Nzg3NiA1OTU3ODc3MTQ4MDQzNjM5IDYwNDI1NjcyODM0NjQ0ODQ=