private function storeNews ($endpoint, News $news)
    {
        $jsonBody = ['articles' => []];

        foreach ($news->getItems() as $newsArticle) {
            $jsonArticle = [
                'title'          => $newsArticle->getTitle(),
                'content'        => $newsArticle->getContent(),
                'thumb_media_id' => $newsArticle->getThumbnailMediaID(),
            ];

            if ($newsArticle->getAuthor() !== null) {
                $jsonArticle['author'] = $newsArticle->getAuthor();
            }

            if ($newsArticle->getURL() !== null) {
                $jsonArticle['content_source_url'] = $newsArticle->getURL();
            }

            if ($newsArticle->getSummary() !== null) {
                $jsonArticle['digest'] = $newsArticle->getSummary();
            }

            $jsonArticle['show_cover_pic'] = $newsArticle->isImageShowing() ? true : false;

            $jsonBody['articles'][] = $jsonArticle;
        }

        return $this->doUpload(
            $endpoint,
            MediaType::ARTICLE,
            json_encode($jsonBody)
        );
    }
private function storeNews ($endpoint, News $news)
    {
        $jsonBody = ['articles' => []];

        foreach ($news->getItems() as $newsArticle) {
            $jsonArticle = [
                'title'          => $newsArticle->getTitle(),
                'content'        => $newsArticle->getContent(),
                'thumb_media_id' => $newsArticle->getThumbnailMediaID(),
            ];

            if ($newsArticle->getAuthor() !== null) {
                $jsonArticle['author'] = $newsArticle->getAuthor();
            }

            if ($newsArticle->getURL() !== null) {
                $jsonArticle['content_source_url'] = $newsArticle->getURL();
            }

            if ($newsArticle->getSummary() !== null) {
                $jsonArticle['digest'] = $newsArticle->getSummary();
            }

            $jsonArticle['show_cover_pic'] = $newsArticle->isImageShowing() ? true : false;

            $jsonBody['articles'][] = $jsonArticle;
        }

        return $this->doUpload(
            $endpoint,
            MediaType::ARTICLE,
            json_encode($jsonBody)
        );
    }
private function storeNews ( $ endpoint , News $ news ) { $ jsonBody = [ 'articles' => [ ] ] ; foreach ( $ news -> getItems ( ) as $ newsArticle ) { $ jsonArticle = [ 'title' => $ newsArticle -> getTitle ( ) , 'content' => $ newsArticle -> getContent ( ) , 'thumb_media_id' => $ newsArticle -> getThumbnailMediaID ( ) , ] ; if ( $ newsArticle -> getAuthor ( ) !== null ) { $ jsonArticle [ 'author' ] = $ newsArticle -> getAuthor ( ) ; } if ( $ newsArticle -> getURL ( ) !== null ) { $ jsonArticle [ 'content_source_url' ] = $ newsArticle -> getURL ( ) ; } if ( $ newsArticle -> getSummary ( ) !== null ) { $ jsonArticle [ 'digest' ] = $ newsArticle -> getSummary ( ) ; } $ jsonArticle [ 'show_cover_pic' ] = $ newsArticle -> isImageShowing ( ) ? true : false ; $ jsonBody [ 'articles' ] [ ] = $ jsonArticle ; } return $ this -> doUpload ( $ endpoint , MediaType :: ARTICLE , json_encode ( $ jsonBody ) ) ; }
Handles the uploading of a news item to the WeChat servers.

@param string $endpoint
@param News   $news

@return \stdClass
Handles the uploading of a news item to the WeChat servers .