original_string: private function throwEncodeError(int $code, $data)
      {
          switch ($code) {
              case JSON_ERROR_DEPTH:
                  $msg = 'Maximum stack depth exceeded';
                  break;
              case JSON_ERROR_STATE_MISMATCH:
                  $msg = 'Underflow or the modes mismatch';
                  break;
              case JSON_ERROR_CTRL_CHAR:
                  $msg = 'Unexpected control character found';
                  break;
              case JSON_ERROR_UTF8:
                  $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
                  break;
              default:
                  $msg = 'Unknown error';
          }
  
          throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true));
      }
code: private function throwEncodeError(int $code, $data)
      {
          switch ($code) {
              case JSON_ERROR_DEPTH:
                  $msg = 'Maximum stack depth exceeded';
                  break;
              case JSON_ERROR_STATE_MISMATCH:
                  $msg = 'Underflow or the modes mismatch';
                  break;
              case JSON_ERROR_CTRL_CHAR:
                  $msg = 'Unexpected control character found';
                  break;
              case JSON_ERROR_UTF8:
                  $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
                  break;
              default:
                  $msg = 'Unknown error';
          }
  
          throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true));
      }
code_tokens: private function throwEncodeError ( int $ code , $ data ) { switch ( $ code ) { case JSON_ERROR_DEPTH : $ msg = 'Maximum stack depth exceeded' ; break ; case JSON_ERROR_STATE_MISMATCH : $ msg = 'Underflow or the modes mismatch' ; break ; case JSON_ERROR_CTRL_CHAR : $ msg = 'Unexpected control character found' ; break ; case JSON_ERROR_UTF8 : $ msg = 'Malformed UTF-8 characters, possibly incorrectly encoded' ; break ; default : $ msg = 'Unknown error' ; } throw new \ RuntimeException ( 'JSON encoding failed: ' . $ msg . '. Encoding: ' . var_export ( $ data , true ) ) ; }
docstring: Throws an exception according to a given code with a customized message
  
  @param  int               $code return code of json_last_error function
  @param  mixed             $data data that was meant to be encoded
  @throws \RuntimeException
docstring_tokens: Throws an exception according to a given code with a customized message