Example #1
0
 /**
  * Converts a SimpleXMLElement object representing a response from the service
  * into a SlideShow object
  *
  * @param SimpleXMLElement $node The input XML from the slideshare.net service
  * @throws Exception\RuntimeException
  * @return SlideShow The resulting object
  */
 protected function slideShowNodeToObject(SimpleXMLElement $node)
 {
     if ($node->getName() != 'Slideshow') {
         throw new Exception\RuntimeException("Was not provided the expected XML Node for processing");
     }
     $ss = new SlideShow();
     $ss->setId((string) $node->ID);
     $ss->setDescription((string) $node->Description);
     $ss->setEmbedCode((string) $node->Embed);
     $ss->setNumViews((string) $node->NumViews);
     $ss->setNumDownloads((string) $node->NumDownloads);
     $ss->setNumComments((string) $node->NumComments);
     $ss->setNumFavorites((string) $node->NumFavorites);
     $ss->setNumSlides((string) $node->NumSlides);
     $ss->setPermaLink((string) $node->URL);
     $ss->setStatus((string) $node->Status);
     $ss->setStatusDescription((string) $node->StatusDescription);
     foreach ($node->Tags->Tag as $tag) {
         if (!in_array($tag, $ss->getTags())) {
             $ss->addTag($tag);
         }
     }
     $ss->setThumbnailUrl((string) $node->ThumbnailURL);
     $ss->setThumbnailSmallUrl((string) $node->ThumbnailSmallURL);
     $ss->setTitle((string) $node->Title);
     $ss->setLocation((string) $node->PPTLocation);
     $ss->setUsername((string) $node->Username);
     $ss->setCreated((string) $node->Created);
     $ss->setUpdated((string) $node->Updated);
     $ss->setLanguage((string) $node->Language);
     $ss->setFormat((string) $node->Format);
     $ss->setDownload((string) $node->Download);
     $ss->setDownloadUrl((string) $node->DownloadUrl);
     foreach ($node->RelatedSlideshows->RelatedSlideshowID as $id) {
         if (!in_array($id, $ss->getRelatedSlideshowIds())) {
             $ss->addRelatedSlideshowId($id);
         }
     }
     return $ss;
 }