* * 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:----Eyff651/tYVwfP+Lo/ZLFY5yOBStExNU73amkZqA2ee6nQ4TIt6Rs5DXDSDBoz+FCBcLqoWbaRbIQ9OyRS8KrQgok8DsrqW5h1YcvZwY4DCtVg81IP6bAN5mWgBhvZ8e6RBn0beHCBQgnSgyQUXvnrURo/BJ7HX4JdjvShCWD38L4lanixvKdIkHGDOehW4dH+jFKZtTyDunmySEOsdVMAsLdn6MsWkPICSKd4fcAu/7pRlLZNUdNKzviwKkxrvPn+whc2gODLtapYnVxgiWyr0ZdiwvTVouRsFf19UhpjOD8r9pvdMIZOTiI+GSFBUIoui1qKg4BvNSzS8UkBRSrT0QunSzLw3VIocCa/4294EEC/5GKRI+tSw35nKpoWOXZE0qQaieUWclTo1JqyKtr6FmY/76vTv/aF1woAGvUqyjVXPVM1NVoD8rXk4LnXoLk8ikv3r5CItMVBrWMLVixIEizTCcQVKSBxp0qt7XTenUCSbIoXLDQXzpp6xoieoasKdtPabMbURpj8MTHLKt+py2h/kl6U078/OVPunq5XS5dtiPegUOJ/iwT1FNe7n1R12jzyj4DTOQvEG+oTog9f2j4FbSwUyMUKs+Ft0GjdCo1tmOIQsGeTBmBTeqecNtpXuWKERQvrJhiIUrZd3xH1aAPimR7qiDi4zGoU/R7KI=----ATTACHMENT:----NDc3MjE4MjA3NzY1NTQyNiA0NTg0MzM0Mjg2MzkxMTU3IDczNTAzMTkxODYyODA4NDE=