Exemplo n.º 1
0
 /**
  * Load the detail of 1 item.
  * @param string $type
  *   Type of the item. (example: event)
  * @param string $id
  *   ID of the item to load.
  * @return ActivityStatsExtendedEntity
  */
 public function detail($type, $id)
 {
     $response = $this->executeSearch('detail/' . $type . '/' . $id);
     $xmlElement = new SimpleXMLElement($response->getBody(true), 0, false, $this->cdbXmlNamespaceUri);
     $detail = $xmlElement->{$type};
     if (!empty($detail[0])) {
         return ActivityStatsExtendedEntity::fromXml($detail[0]);
     }
 }
 /**
  * @param string $activityType
  */
 public function getActivityCount($activityType)
 {
     return parent::getActivityCount($activityType);
 }
Exemplo n.º 3
0
 /**
  * Construct the search result based on the given result xml for pages.
  * @param SimpleXMLElement $xmlElement
  * @return \CultuurNet\Search\SearchResult
  */
 public static function fromPagesXml(SimpleXMLElement $xmlElement)
 {
     $result = new static();
     $result->type = 'pages';
     $result->total = intval($xmlElement->total);
     // Store parsed version. Set this to NULL before you cache it.
     $result->xmlElement = $xmlElement;
     // Store string version of xml, so the result object can be cached.
     $result->xml = $xmlElement->asXML();
     if (!empty($xmlElement->items) && !empty($xmlElement->items->item)) {
         foreach ($xmlElement->items->item as $xmlItem) {
             $entity = ActivityStatsExtendedEntity::fromPagesXml($xmlItem);
             if ($entity) {
                 $result->items[] = $entity;
             }
         }
     }
     if (!empty($xmlElement->suggestions)) {
         foreach ($xmlElement->suggestions->suggestion as $suggestionElement) {
             $result->suggestions[] = (string) $suggestionElement;
         }
     }
     return $result;
 }