예제 #1
0
 public function getItem($id)
 {
     $path = APPLICATION_PATH . "/{$id}.xml";
     if (!file_exists($path)) {
         return null;
     }
     $xml = simplexml_load_file($path);
     return NewsItem::createFromXml($xml->contentSet->newItem);
 }
예제 #2
0
 /**
  * Get item
  *
  * @param string $id
  * @return Newscoop\News\NewsItem
  */
 public function getItem($id)
 {
     $response = $this->getClient()->restGet('/rmd/rest/xml/item', array('token' => $this->getToken(), 'id' => $id));
     $xml = $this->parseResponse($response);
     if (!empty($xml->itemSet->newsItem)) {
         return NewsItem::createFromXml($xml->itemSet->newsItem);
     } else {
         if (!empty($xml->packageItem)) {
             return PackageItem::createFromXml($xml->packageItem);
         } else {
             if (!empty($xml->itemSet->packageItem)) {
                 return PackageItem::createFromXml($xml->itemSet->packageItem);
             } else {
                 var_dump('not implemented', $xml->asXML());
                 exit;
                 throw new \InvalidArgumentException("Not implemented");
             }
         }
     }
     return;
 }