/**
  * The item is valid if it was last updated after the modified since date.
  *
  * @param Item $item
  *
  * @return bool
  * @deprecated removed in version 3.0
  */
 public function isValid(ItemOutInterface $item)
 {
     if ($item->getUpdated() instanceof \DateTime) {
         return $item->getUpdated() > $this->getDate();
     }
     return false;
 }
 /**
  * @param \DOMDocument     $document
  * @param ItemOutInterface $item
  */
 protected function addEntry(\DOMDocument $document, ItemOutInterface $item)
 {
     $entry = $document->createElement('entry');
     $elements = array();
     $elements[] = $document->createElement('title', htmlspecialchars($item->getTitle()));
     $link = $document->createElement('link');
     $link->setAttribute('href', $item->getLink());
     $elements[] = $link;
     $elements[] = $document->createElement('id', $item->getLink());
     $elements[] = $document->createElement('updated', $item->getUpdated()->format(\DateTime::ATOM));
     if (strlen($item->getSummary()) > 0) {
         $summary = $document->createElement('summary', htmlspecialchars($item->getSummary(), ENT_COMPAT, 'UTF-8'));
         $summary->setAttribute('type', self::CONTENT_TYPE_HTML);
     }
     $content = $document->createElement('content', htmlspecialchars($item->getDescription(), ENT_COMPAT, 'UTF-8'));
     $content->setAttribute('type', self::CONTENT_TYPE_HTML);
     $elements[] = $content;
     if (!is_null($item->getComment())) {
         $comments = $document->createElement('link');
         $comments->setAttribute('href', $item->getComment());
         $comments->setAttribute('rel', 'related');
         $elements[] = $comments;
     }
     if (!is_null($item->getAuthor())) {
         $author = $document->createElement('author');
         $author->appendChild($document->createElement('name', $item->getAuthor()));
         $elements[] = $author;
     }
     foreach ($item->getMedias() as $media) {
         $mediaLink = $document->createElement('link');
         $mediaLink->setAttribute('rel', 'enclosure');
         $mediaLink->setAttribute('href', $media->getUrl());
         $mediaLink->setAttribute('length', $media->getLength());
         $mediaLink->setAttribute('type', $media->getType());
         $elements[] = $mediaLink;
     }
     foreach ($elements as $element) {
         $entry->appendChild($element);
     }
     $document->documentElement->appendChild($entry);
 }
 /**
  * @param \DomDocument     $document
  * @param ItemOutInterface $item
  */
 protected function addEntry(\DomDocument $document, ItemOutInterface $item)
 {
     $entry = $document->createElement('item');
     $elements = array();
     $elements[] = $document->createElement('title', htmlspecialchars($item->getTitle()));
     $elements[] = $document->createElement('link', $item->getLink());
     $elements[] = $document->createElement('guid', $item->getPublicId());
     $elements[] = $document->createElement('pubDate', $item->getUpdated()->format(\DateTime::RSS));
     $elements[] = $document->createElement('comments', $item->getComment());
     $elements[] = $document->createElement('description', htmlspecialchars($item->getDescription(), ENT_COMPAT, 'UTF-8'));
     $mediaCount = 0;
     foreach ($item->getMedias() as $media) {
         // We can have only one enclosure in RSS 2.0
         // We use as a fallback Yahoo RSS Media extension
         if (0 === $mediaCount) {
             $mediaElement = $document->createElement('enclosure');
             $mediaElement->setAttribute('url', $media->getUrl());
             $mediaElement->setAttribute('length', $media->getLength());
             $mediaElement->setAttribute('type', $media->getType());
         }
         $mediaElement = $document->createElement('media:content');
         $mediaElement->setAttribute('url', $media->getUrl());
         $mediaElement->setAttribute('fileSize', $media->getLength());
         $mediaElement->setAttribute('type', $media->getType());
         $mediaElement->setAttribute('xmlns:media', 'http://search.yahoo.com/mrss/');
         $elements[] = $mediaElement;
         $mediaCount++;
     }
     if (!is_null($item->getAuthor())) {
         $elements[] = $document->createElement('author', $item->getAuthor());
     }
     foreach ($elements as $element) {
         $entry->appendChild($element);
     }
     $document->documentElement->firstChild->appendChild($entry);
 }