Example #1
0
File: Rss.php Project: seytar/psx
 protected function buildChannel(RssRecord $rss, Writer $writer)
 {
     $language = $rss->getLanguage();
     if (!empty($language)) {
         $writer->setLanguage($language);
     }
     $copyright = $rss->getCopyright();
     if (!empty($copyright)) {
         $writer->setCopyright($copyright);
     }
     $managingEditor = $rss->getManagingEditor();
     if (!empty($managingEditor)) {
         $writer->setManagingEditor($managingEditor);
     }
     $webMaster = $rss->getWebMaster();
     if (!empty($webMaster)) {
         $writer->setWebMaster($webMaster);
     }
     $pubDate = $rss->getPubDate();
     if ($pubDate instanceof DateTime) {
         $writer->setPubDate($pubDate);
     }
     $lastBuildDate = $rss->getLastBuildDate();
     if ($lastBuildDate instanceof DateTime) {
         $writer->setLastBuildDate($lastBuildDate);
     }
     $categories = $rss->getCategory();
     if (is_array($categories)) {
         foreach ($categories as $category) {
             $writer->addCategory($category->getText(), $category->getDomain());
         }
     }
     $generator = $rss->getGenerator();
     if (!empty($generator)) {
         $writer->setGenerator($generator);
     }
     $docs = $rss->getDocs();
     if (!empty($docs)) {
         $writer->setDocs($docs);
     }
     $cloud = $rss->getCloud();
     if ($cloud instanceof Cloud) {
         $writer->setCloud($cloud->getDomain(), $cloud->getPort(), $cloud->getPath(), $cloud->getRegisterProcedure(), $cloud->getProtocol());
     }
     $ttl = $rss->getTtl();
     if (!empty($ttl)) {
         $writer->setTtl($ttl);
     }
     $rating = $rss->getRating();
     if (!empty($rating)) {
         $writer->setRating($rating);
     }
     $skipHours = $rss->getSkipHours();
     if (!empty($skipHours)) {
         $writer->setSkipHours($skipHours);
     }
     $skipDays = $rss->getSkipDays();
     if (!empty($skipDays)) {
         $writer->setSkipDays($skipDays);
     }
 }