original_string: public function encodeHeader($str, $position = 'text') {
          $encoded = core_text::encode_mimeheader($str, $this->CharSet);
          if ($encoded !== false) {
              if ($position === 'phrase') {
                  // Escape special symbols in each line in the encoded string, join back together and enclose in quotes.
                  $chunks = preg_split("/\\n/", $encoded);
                  $chunks = array_map(function($chunk) {
                      return addcslashes($chunk, "\0..\37\177\\\"");
                  }, $chunks);
                  return '"' . join(parent::getLE(), $chunks) . '"';
              }
              return str_replace("\n", parent::getLE(), $encoded);
          }
  
          return parent::encodeHeader($str, $position);
      }
code: public function encodeHeader($str, $position = 'text') {
          $encoded = core_text::encode_mimeheader($str, $this->CharSet);
          if ($encoded !== false) {
              if ($position === 'phrase') {
                  // Escape special symbols in each line in the encoded string, join back together and enclose in quotes.
                  $chunks = preg_split("/\\n/", $encoded);
                  $chunks = array_map(function($chunk) {
                      return addcslashes($chunk, "\0..\37\177\\\"");
                  }, $chunks);
                  return '"' . join(parent::getLE(), $chunks) . '"';
              }
              return str_replace("\n", parent::getLE(), $encoded);
          }
  
          return parent::encodeHeader($str, $position);
      }
code_tokens: public function encodeHeader ( $ str , $ position = 'text' ) { $ encoded = core_text :: encode_mimeheader ( $ str , $ this -> CharSet ) ; if ( $ encoded !== false ) { if ( $ position === 'phrase' ) { // Escape special symbols in each line in the encoded string, join back together and enclose in quotes. $ chunks = preg_split ( "/\\n/" , $ encoded ) ; $ chunks = array_map ( function ( $ chunk ) { return addcslashes ( $ chunk , "\0..\37\177\\\"" ) ; } , $ chunks ) ; return '"' . join ( parent :: getLE ( ) , $ chunks ) . '"' ; } return str_replace ( "\n" , parent :: getLE ( ) , $ encoded ) ; } return parent :: encodeHeader ( $ str , $ position ) ; }
docstring: Use internal moodles own core_text to encode mimeheaders.
  Fall back to phpmailers inbuilt functions if not
docstring_tokens: Use internal moodles own core_text to encode mimeheaders . Fall back to phpmailers inbuilt functions if not