original_string: protected function _getTransferEncoding($encode = self::ENCODE_7BIT)
      {
          if (!empty($this->_temp['sendEncoding'])) {
              return $this->_temp['sendEncoding'];
          } elseif (!empty($this->_temp['sendTransferEncoding'][$encode])) {
              return $this->_temp['sendTransferEncoding'][$encode];
          }
  
          if (empty($this->_contents)) {
              $encoding = '7bit';
          } else {
              switch ($this->getPrimaryType()) {
              case 'message':
              case 'multipart':
                  /* RFC 2046 [5.2.1] - message/rfc822 messages only allow 7bit,
                   * 8bit, and binary encodings. If the current encoding is
                   * either base64 or q-p, switch it to 8bit instead.
                   * RFC 2046 [5.2.2, 5.2.3, 5.2.4] - All other messages
                   * only allow 7bit encodings.
                   *
                   * TODO: What if message contains 8bit characters and we are
                   * in strict 7bit mode? Not sure there is anything we can do
                   * in that situation, especially for message/rfc822 parts.
                   *
                   * These encoding will be figured out later (via toString()).
                   * They are limited to 7bit, 8bit, and binary. Default to
                   * '7bit' per RFCs. */
                  $default_8bit = 'base64';
                  $encoding = '7bit';
                  break;
  
              case 'text':
                  $default_8bit = 'quoted-printable';
                  $encoding = '7bit';
                  break;
  
              default:
                  $default_8bit = 'base64';
                  /* If transfer encoding has changed from the default, use that
                   * value. */
                  $encoding = ($this->_transferEncoding == self::DEFAULT_ENCODING)
                      ? 'base64'
                      : $this->_transferEncoding;
                  break;
              }
  
              switch ($encoding) {
              case 'base64':
              case 'binary':
                  break;
  
              default:
                  $encoding = $this->_scanStream($this->_contents);
                  break;
              }
  
              switch ($encoding) {
              case 'base64':
              case 'binary':
                  /* If the text is longer than 998 characters between
                   * linebreaks, use quoted-printable encoding to ensure the
                   * text will not be chopped (i.e. by sendmail if being
                   * sent as mail text). */
                  $encoding = $default_8bit;
                  break;
  
              case '8bit':
                  $encoding = (($encode & self::ENCODE_8BIT) || ($encode & self::ENCODE_BINARY))
                      ? '8bit'
                      : $default_8bit;
                  break;
              }
          }
  
          $this->_temp['sendTransferEncoding'][$encode] = $encoding;
  
          return $encoding;
      }
code: protected function _getTransferEncoding($encode = self::ENCODE_7BIT)
      {
          if (!empty($this->_temp['sendEncoding'])) {
              return $this->_temp['sendEncoding'];
          } elseif (!empty($this->_temp['sendTransferEncoding'][$encode])) {
              return $this->_temp['sendTransferEncoding'][$encode];
          }
  
          if (empty($this->_contents)) {
              $encoding = '7bit';
          } else {
              switch ($this->getPrimaryType()) {
              case 'message':
              case 'multipart':
                  /* RFC 2046 [5.2.1] - message/rfc822 messages only allow 7bit,
                   * 8bit, and binary encodings. If the current encoding is
                   * either base64 or q-p, switch it to 8bit instead.
                   * RFC 2046 [5.2.2, 5.2.3, 5.2.4] - All other messages
                   * only allow 7bit encodings.
                   *
                   * TODO: What if message contains 8bit characters and we are
                   * in strict 7bit mode? Not sure there is anything we can do
                   * in that situation, especially for message/rfc822 parts.
                   *
                   * These encoding will be figured out later (via toString()).
                   * They are limited to 7bit, 8bit, and binary. Default to
                   * '7bit' per RFCs. */
                  $default_8bit = 'base64';
                  $encoding = '7bit';
                  break;
  
              case 'text':
                  $default_8bit = 'quoted-printable';
                  $encoding = '7bit';
                  break;
  
              default:
                  $default_8bit = 'base64';
                  /* If transfer encoding has changed from the default, use that
                   * value. */
                  $encoding = ($this->_transferEncoding == self::DEFAULT_ENCODING)
                      ? 'base64'
                      : $this->_transferEncoding;
                  break;
              }
  
              switch ($encoding) {
              case 'base64':
              case 'binary':
                  break;
  
              default:
                  $encoding = $this->_scanStream($this->_contents);
                  break;
              }
  
              switch ($encoding) {
              case 'base64':
              case 'binary':
                  /* If the text is longer than 998 characters between
                   * linebreaks, use quoted-printable encoding to ensure the
                   * text will not be chopped (i.e. by sendmail if being
                   * sent as mail text). */
                  $encoding = $default_8bit;
                  break;
  
              case '8bit':
                  $encoding = (($encode & self::ENCODE_8BIT) || ($encode & self::ENCODE_BINARY))
                      ? '8bit'
                      : $default_8bit;
                  break;
              }
          }
  
          $this->_temp['sendTransferEncoding'][$encode] = $encoding;
  
          return $encoding;
      }
code_tokens: protected function _getTransferEncoding ( $ encode = self :: ENCODE_7BIT ) { if ( ! empty ( $ this -> _temp [ 'sendEncoding' ] ) ) { return $ this -> _temp [ 'sendEncoding' ] ; } elseif ( ! empty ( $ this -> _temp [ 'sendTransferEncoding' ] [ $ encode ] ) ) { return $ this -> _temp [ 'sendTransferEncoding' ] [ $ encode ] ; } if ( empty ( $ this -> _contents ) ) { $ encoding = '7bit' ; } else { switch ( $ this -> getPrimaryType ( ) ) { case 'message' : case 'multipart' : /* RFC 2046 [5.2.1] - message/rfc822 messages only allow 7bit,
                   * 8bit, and binary encodings. If the current encoding is
                   * either base64 or q-p, switch it to 8bit instead.
                   * RFC 2046 [5.2.2, 5.2.3, 5.2.4] - All other messages
                   * only allow 7bit encodings.
                   *
                   * TODO: What if message contains 8bit characters and we are
                   * in strict 7bit mode? Not sure there is anything we can do
                   * in that situation, especially for message/rfc822 parts.
                   *
                   * These encoding will be figured out later (via toString()).
                   * They are limited to 7bit, 8bit, and binary. Default to
                   * '7bit' per RFCs. */ $ default_8bit = 'base64' ; $ encoding = '7bit' ; break ; case 'text' : $ default_8bit = 'quoted-printable' ; $ encoding = '7bit' ; break ; default : $ default_8bit = 'base64' ; /* If transfer encoding has changed from the default, use that
                   * value. */ $ encoding = ( $ this -> _transferEncoding == self :: DEFAULT_ENCODING ) ? 'base64' : $ this -> _transferEncoding ; break ; } switch ( $ encoding ) { case 'base64' : case 'binary' : break ; default : $ encoding = $ this -> _scanStream ( $ this -> _contents ) ; break ; } switch ( $ encoding ) { case 'base64' : case 'binary' : /* If the text is longer than 998 characters between
                   * linebreaks, use quoted-printable encoding to ensure the
                   * text will not be chopped (i.e. by sendmail if being
                   * sent as mail text). */ $ encoding = $ default_8bit ; break ; case '8bit' : $ encoding = ( ( $ encode & self :: ENCODE_8BIT ) || ( $ encode & self :: ENCODE_BINARY ) ) ? '8bit' : $ default_8bit ; break ; } } $ this -> _temp [ 'sendTransferEncoding' ] [ $ encode ] = $ encoding ; return $ encoding ; }
docstring: Get the transfer encoding for the part based on the user requested
  transfer encoding and the current contents of the part.
  
  @param integer $encode  A mask of allowable encodings.
  
  @return string  The transfer-encoding of this part.
docstring_tokens: Get the transfer encoding for the part based on the user requested transfer encoding and the current contents of the part .