예제 #1
0
 /**
  * Build an AnalyzedQuicklink by combining the quicklink and analytics data
  * @param $eventBuckets
  * @param $quicklinkResult
  * @return AnalyzedQuickLink
  */
 private function makeAnalyzedQuicklink($eventBuckets, $quicklinkResult)
 {
     $quicklink = AnalyzedQuickLink::fromStdClass($quicklinkResult);
     if (isset($eventBuckets)) {
         $quicklink->setTotalEvents($eventBuckets->doc_count);
         foreach ($eventBuckets->events->buckets as $event) {
             $analyticsEvent = new AnalyticsEvent($event->key, $event->doc_count, sizeof($event->unique_visitors->buckets));
             $quicklink->addEvent($analyticsEvent);
         }
     }
     return $quicklink;
 }
 public static function fromJson($json)
 {
     $mixed = json_decode($json);
     return AnalyzedQuickLink::fromStdClass($mixed);
 }