class HeartbeatMessageBuilder in Heartbeat 6.3
Same name and namespace in other branches
- 6.4 includes/heartbeatmessagebuilder.inc \HeartbeatMessageBuilder
Class HeartbeatMessageBuilder Message builder that fetches and customizes a users activity on the site. The builder takes a heartbeataccess state object to handle the request to fetch the messages.
Hierarchy
- class \HeartbeatMessageBuilder
Expanded class hierarchy of HeartbeatMessageBuilder
File
- includes/
heartbeatmessagebuilder.inc, line 27 - Strategy with access behaviour
View source
class HeartbeatMessageBuilder {
private $_heartbeatState = null;
private $_hasErrors = FALSE;
private $_errors = array();
public function __construct(HeartbeatAccess $heartbeatState) {
if (!$heartbeatState
->hasErrors()) {
$this->_heartbeatState = $heartbeatState;
}
else {
$this
->setError($heartbeatState
->getErrors());
}
}
public function hasErrors() {
return $this->_hasErrors;
}
protected function setError($errors) {
$this->_errors = $errors;
$this->_hasErrors = TRUE;
}
public function execute() {
$heartbeat = $this->_heartbeatState
->fetchMessages();
if (!empty($heartbeat->raw_messages)) {
return $this
->group($heartbeat);
}
return array();
}
/**
* @see class HeartbeatParser
*/
public function group(HeartbeatParser $heartbeat) {
$heartbeat
->set_timespan_gap(variable_get('heartbeat_activity_grouping_seconds', 720));
$heartbeat
->build_sets($heartbeat->raw_messages);
$heartbeat
->merge_sets();
$messages = $heartbeat
->get_messages();
// $messages = $heartbeat->remove_broken_messages();
return $messages;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HeartbeatMessageBuilder:: |
private | property | ||
HeartbeatMessageBuilder:: |
private | property | ||
HeartbeatMessageBuilder:: |
private | property | ||
HeartbeatMessageBuilder:: |
public | function | ||
HeartbeatMessageBuilder:: |
public | function | ||
HeartbeatMessageBuilder:: |
public | function | ||
HeartbeatMessageBuilder:: |
protected | function | ||
HeartbeatMessageBuilder:: |
public | function |