original_string: public function encode($data, $format, array $context = [])
      {
          $jsonEncodeOptions = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS];
          $encodedJson = json_encode($data, $jsonEncodeOptions);
  
          if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($jsonEncodeOptions & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
              throw new NotEncodableValueException(json_last_error_msg());
          }
  
          return $encodedJson;
      }
code: public function encode($data, $format, array $context = [])
      {
          $jsonEncodeOptions = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS];
          $encodedJson = json_encode($data, $jsonEncodeOptions);
  
          if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($jsonEncodeOptions & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
              throw new NotEncodableValueException(json_last_error_msg());
          }
  
          return $encodedJson;
      }
code_tokens: public function encode ( $ data , $ format , array $ context = [ ] ) { $ jsonEncodeOptions = $ context [ self :: OPTIONS ] ?? $ this -> defaultContext [ self :: OPTIONS ] ; $ encodedJson = json_encode ( $ data , $ jsonEncodeOptions ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) && ( false === $ encodedJson || ! ( $ jsonEncodeOptions & JSON_PARTIAL_OUTPUT_ON_ERROR ) ) ) { throw new NotEncodableValueException ( json_last_error_msg ( ) ) ; } return $ encodedJson ; }
docstring: Encodes PHP data to a JSON string.
  
  {@inheritdoc}
docstring_tokens: Encodes PHP data to a JSON string .