Example #1
0
 /**
  * Converts a SimpleXMLElement object representing a response from the service
  * into a Zend_Service_SlideShare_SlideShow object
  *
  * @see http://www.slideshare.net/developers/documentation#get_slideshow
  *
  * @param SimpleXMLElement $node The input XML from the slideshare.net service
  * @return Zend_Service_SlideShare_SlideShow The resulting object
  * @throws Zend_Service_SlideShare_Exception
  */
 protected function _slideShowNodeToObject(SimpleXMLElement $node)
 {
     if ($node->getName() == 'Slideshow') {
         $ss = new Zend_Service_SlideShare_SlideShow();
         $ss->setId((string) $node->ID);
         $ss->setDescription((string) $node->Description);
         $ss->setEmbedCode((string) $node->Embed);
         $ss->setNumViews((string) $node->Views);
         $ss->setUrl((string) $node->URL);
         $ss->setStatus((string) $node->Status);
         $ss->setStatusDescription((string) $node->StatusDescription);
         foreach (explode(",", (string) $node->Tags) as $tag) {
             if (!in_array($tag, $ss->getTags())) {
                 $ss->addTag($tag);
             }
         }
         $ss->setThumbnailUrl((string) $node->ThumbnailURL);
         $ss->setTitle((string) $node->Title);
         $ss->setLocation((string) $node->Location);
         $ss->setTranscript((string) $node->Transcript);
         return $ss;
     }
     require_once 'Zend/Service/SlideShare/Exception.php';
     throw new Zend_Service_SlideShare_Exception('Was not provided the expected XML Node for processing');
 }