original_string: protected function sendNewsMsgToXmlString(WxSendNewsMsg $msg)
      {
          $itemArray  = $msg->getAllArticleItems();
          $itemStr    = '';
          foreach ($itemArray as $item) {
              $itemStr .= $this->sendNewsItemToXmlString($item);
          }
  
          $formatStr = <<<XML
  <xml>
  <ToUserName><![CDATA[%s]]></ToUserName>
  <FromUserName><![CDATA[%s]]></FromUserName>
  <CreateTime>%d</CreateTime>
  <MsgType><![CDATA[%s]]></MsgType>
  <ArticleCount>%d</ArticleCount>
  <Articles>
  %s
  </Articles>
  </xml>
  XML;
  
          $result = sprintf($formatStr,   $msg->getToUserName(),
                                          $msg->getFromUserName(),
                                          strtotime($msg->getCreateTime()),
                                          $msg->getMsgType(),
                                          $msg->getArticleCount(),
                                          $itemStr
                          );
  
          return $result;
      }
code: protected function sendNewsMsgToXmlString(WxSendNewsMsg $msg)
      {
          $itemArray  = $msg->getAllArticleItems();
          $itemStr    = '';
          foreach ($itemArray as $item) {
              $itemStr .= $this->sendNewsItemToXmlString($item);
          }
  
          $formatStr = <<<XML
  <xml>
  <ToUserName><![CDATA[%s]]></ToUserName>
  <FromUserName><![CDATA[%s]]></FromUserName>
  <CreateTime>%d</CreateTime>
  <MsgType><![CDATA[%s]]></MsgType>
  <ArticleCount>%d</ArticleCount>
  <Articles>
  %s
  </Articles>
  </xml>
  XML;
  
          $result = sprintf($formatStr,   $msg->getToUserName(),
                                          $msg->getFromUserName(),
                                          strtotime($msg->getCreateTime()),
                                          $msg->getMsgType(),
                                          $msg->getArticleCount(),
                                          $itemStr
                          );
  
          return $result;
      }
code_tokens: protected function sendNewsMsgToXmlString ( WxSendNewsMsg $ msg ) { $ itemArray = $ msg -> getAllArticleItems ( ) ; $ itemStr = '' ; foreach ( $ itemArray as $ item ) { $ itemStr .= $ this -> sendNewsItemToXmlString ( $ item ) ; } $ formatStr =  <<<XML
  <xml>
  <ToUserName><![CDATA[%s]]></ToUserName>
  <FromUserName><![CDATA[%s]]></FromUserName>
  <CreateTime>%d</CreateTime>
  <MsgType><![CDATA[%s]]></MsgType>
  <ArticleCount>%d</ArticleCount>
  <Articles>
  %s
  </Articles>
  </xml>
  XML ; $ result = sprintf ( $ formatStr , $ msg -> getToUserName ( ) , $ msg -> getFromUserName ( ) , strtotime ( $ msg -> getCreateTime ( ) ) , $ msg -> getMsgType ( ) , $ msg -> getArticleCount ( ) , $ itemStr ) ; return $ result ; }
docstring: formatter WxSendNewsMsg to xml string
  @param WxSendNewsMsg $msg
  @return string
docstring_tokens: formatter WxSendNewsMsg to xml string