original_string: public function setData($data = [])
      {
          try {
              $data = json_encode($data, $this->encodingOptions);
          } catch (\Exception $e) {
              if ('Exception' === \get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
                  throw $e->getPrevious() ?: $e;
              }
              throw $e;
          }
  
          if (JSON_ERROR_NONE !== json_last_error()) {
              throw new \InvalidArgumentException(json_last_error_msg());
          }
  
          return $this->setJson($data);
      }
code: public function setData($data = [])
      {
          try {
              $data = json_encode($data, $this->encodingOptions);
          } catch (\Exception $e) {
              if ('Exception' === \get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
                  throw $e->getPrevious() ?: $e;
              }
              throw $e;
          }
  
          if (JSON_ERROR_NONE !== json_last_error()) {
              throw new \InvalidArgumentException(json_last_error_msg());
          }
  
          return $this->setJson($data);
      }
code_tokens: public function setData ( $ data = [ ] ) { try { $ data = json_encode ( $ data , $ this -> encodingOptions ) ; } catch ( \ Exception $ e ) { if ( 'Exception' === \ get_class ( $ e ) && 0 === strpos ( $ e -> getMessage ( ) , 'Failed calling ' ) ) { throw $ e -> getPrevious ( ) ? : $ e ; } throw $ e ; } if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw new \ InvalidArgumentException ( json_last_error_msg ( ) ) ; } return $ this -> setJson ( $ data ) ; }
docstring: Sets the data to be sent as JSON.
  
  @param mixed $data
  
  @return $this
  
  @throws \InvalidArgumentException
docstring_tokens: Sets the data to be sent as JSON .