Antidot PHP API  version 0.16.0
##PHP API to simplify integration of Antidot components
 All Classes Files Functions Variables Groups Pages
Public Member Functions | List of all members
AfsClusterHelper Class Reference

Helper for one cluster reply. More...

Inheritance diagram for AfsClusterHelper:
AfsHelperBase

Public Member Functions

 __construct ($cluster, AfsMetaHelper $meta, $facet_helper, AfsQuery $query, AfsHelperConfiguration $config)
 Constructs new cluster helper instance.
 get_id ()
 Retrieves identifier of the facet value defined for current cluster.
 get_label ()
 Retrieves label of the facet value defined for current cluster.
 get_total_replies ()
 Retrieves number of replies in the cluster.
 has_reply ()
 Checks whether current cluster has replies.
 get_nb_replies ()
 Retrieves number of replies in current cluster.
 get_replies ()
 Retrieves all clustered replies.
 get_query ()
 Retrieves query to filter on current cluster.
 format ()
 Retrieves cluster as array.
- Public Member Functions inherited from AfsHelperBase
 __get ($name)
 Simple property helper.

Detailed Description

Helper for one cluster reply.

Constructor & Destructor Documentation

__construct (   $cluster,
AfsMetaHelper  $meta,
  $facet_helper,
AfsQuery  $query,
AfsHelperConfiguration  $config 
)

Constructs new cluster helper instance.

Parameters
$cluster[in] One cluster reply.
$meta[in] Reply set meta data.
$facet_helper[in] Facet helper (used to retrieve value label).
$query[in] AfsQuery object previously initialized. It is used to generate new query to filter on this cluster reply.
$config[in] Helper configuration.

Member Function Documentation

format ( )

Retrieves cluster as array.

All data are store in key => value format:

  • id: cluster id (ie identifier of facet value used to make current cluster),
  • label: cluster label (ie label of the facet value, fallback to id when no label is available),
  • total_replies: number of replies in current cluster,
  • replies: list of replies for current cluster (see AfsReplyHelper::format),
  • link: link which can be used to filter on this specific cluster. You MUST have provided query coder to helper configuration otherwise link is set to empty string.
Returns
array filled with key and values.
get_id ( )

Retrieves identifier of the facet value defined for current cluster.

Returns
facet value identifier.
get_label ( )

Retrieves label of the facet value defined for current cluster.

Returns
facet value label.
get_nb_replies ( )

Retrieves number of replies in current cluster.

Returns
replies in current cluster.
get_query ( )

Retrieves query to filter on current cluster.

Using this query allows to

Returns
get_replies ( )

Retrieves all clustered replies.

Returns
clustered replies.
get_total_replies ( )

Retrieves number of replies in the cluster.

Returns
number of replies.
has_reply ( )

Checks whether current cluster has replies.

Returns
True when at least one reply is present, false otherwise.