Exemplo n.º 1
0
 /** @brief Retrieve replyset as array.
  *
  * All data are store in <tt>key => value</tt> format:
  * @li @c meta: array of meta data (@a AfsMetaHelper::format),
  * @li @c nb_replies: number of replies on the current page.
  * @li @c replies: standard or Promote reply.
  * @li @c facets: array of facets (@a AfsFacetHelper::format),
  * @li @c pager: array of pages (@a AfsPagerHelper::format),
  *
  * @return array filled with key and values.
  */
 public function format()
 {
     $result = parent::format();
     if ($this->has_facet()) {
         $result['facets'] = array();
         foreach ($this->get_facets() as $facet_id => $facet) {
             $result['facets'][$facet_id] = $facet->format();
         }
     }
     if ($this->has_cluster()) {
         $formatted_cluster = array();
         foreach ($this->get_clusters() as $cluster_id => $cluster) {
             $formatted_cluster[$cluster_id] = $cluster->format();
         }
         $result['clusters'] = $formatted_cluster;
     }
     if ($this->has_pager()) {
         $result['pager'] = $this->get_pager()->format();
     }
     return $result;
 }
 /** @brief Construct new Promote replyset helper instance.
  *
  * @param $reply_set [in] one reply from decoded json reply.
  * @param $config [in] helper configuration object.
  */
 public function __construct($reply_set, AfsHelperConfiguration $config)
 {
     parent::__construct($reply_set, $config, new AfsReplyHelperFactory());
 }