getVersion() public méthode

Return the type of this feed item
public getVersion ( ) : string
Résultat string The feed type, as defined in Feed.php
Exemple #1
0
 /**
  * Add a FeedItem to the main class
  *
  * @access   public
  * @param    Item    instance of Item class
  * @return   self
  */
 public function addItem(Item $feedItem)
 {
     if ($feedItem->getVersion() != $this->version) {
         die('Feed type mismatch: This instance can handle ' . $this->version . ' feeds only, but item with type ' . $feedItem->getVersion() . ' given.');
     }
     $this->items[] = $feedItem;
     return $this;
 }
Exemple #2
0
 /**
  * Add a FeedItem to the main class
  *
  * @access   public
  * @param    Item   $feedItem instance of Item class
  * @return   self
  * @throws   \InvalidArgumentException if the given item version mismatches.
  */
 public function addItem(Item $feedItem)
 {
     if ($feedItem->getVersion() != $this->version) {
         $msg = sprintf('Feed type mismatch: This instance can handle %s feeds only, but item for %s feeds given.', $this->version, $feedItem->getVersion());
         throw new \InvalidArgumentException($msg);
     }
     $this->items[] = $feedItem;
     return $this;
 }