original_string: public function setContents($contents, $options = array())
      {
          if (is_resource($contents) && ($contents === $this->_contents)) {
              return;
          }
  
          if (empty($options['encoding'])) {
              $options['encoding'] = $this->_transferEncoding;
          }
  
          $fp = (empty($options['usestream']) || !is_resource($contents))
              ? $this->_writeStream($contents)
              : $contents;
  
          /* Properly close the existing stream. */
          $this->clearContents();
  
          $this->setTransferEncoding($options['encoding']);
          $this->_contents = $this->_transferDecode($fp, $options['encoding']);
      }
code: public function setContents($contents, $options = array())
      {
          if (is_resource($contents) && ($contents === $this->_contents)) {
              return;
          }
  
          if (empty($options['encoding'])) {
              $options['encoding'] = $this->_transferEncoding;
          }
  
          $fp = (empty($options['usestream']) || !is_resource($contents))
              ? $this->_writeStream($contents)
              : $contents;
  
          /* Properly close the existing stream. */
          $this->clearContents();
  
          $this->setTransferEncoding($options['encoding']);
          $this->_contents = $this->_transferDecode($fp, $options['encoding']);
      }
code_tokens: public function setContents ( $ contents , $ options = array ( ) ) { if ( is_resource ( $ contents ) && ( $ contents === $ this -> _contents ) ) { return ; } if ( empty ( $ options [ 'encoding' ] ) ) { $ options [ 'encoding' ] = $ this -> _transferEncoding ; } $ fp = ( empty ( $ options [ 'usestream' ] ) || ! is_resource ( $ contents ) ) ? $ this -> _writeStream ( $ contents ) : $ contents ; /* Properly close the existing stream. */ $ this -> clearContents ( ) ; $ this -> setTransferEncoding ( $ options [ 'encoding' ] ) ; $ this -> _contents = $ this -> _transferDecode ( $ fp , $ options [ 'encoding' ] ) ; }
docstring: Set the body contents of this part.
  
  @param mixed $contents  The part body. Either a string or a stream
  resource, or an array containing both.
  @param array $options   Additional options:
  - encoding: (string) The encoding of $contents.
  DEFAULT: Current transfer encoding value.
  - usestream: (boolean) If $contents is a stream, should we directly
  use that stream?
  DEFAULT: $contents copied to a new stream.
docstring_tokens: Set the body contents of this part .