class HeartbeatMessagePool in Heartbeat 7
Class to keep HeartbeatActivity messages in a pool so plugins and such can get the message instead of reloading them.
Hierarchy
- class \HeartbeatMessagePool
Expanded class hierarchy of HeartbeatMessagePool
File
- ./
heartbeat.module, line 962 - Module file for heartbeat activity. Basic hook implementations and helper functions will be found here.
View source
class HeartbeatMessagePool {
private static $instance = NULL;
private $activity = array();
/**
* Constructor.
*/
private function __construct() {
}
/**
* getInstance().
*/
public static function getInstance() {
if (!isset(self::$instance)) {
self::$instance = new HeartbeatMessagePool();
}
return self::$instance;
}
/**
* getMessage().
*/
public function getMessage($uaid) {
if (!isset($this->activity[$uaid])) {
$activity = _heartbeat_activity_load($uaid);
if (!empty($activity)) {
$this
->addMessage($activity);
return $this->activity[$uaid];
}
else {
return NULL;
}
}
else {
return $this->activity[$uaid];
}
}
/**
* addMessage().
*/
public function addMessage($heartbeatActivity) {
if (isset($heartbeatActivity)) {
if (!isset($this->activity[$heartbeatActivity->uaid])) {
$this->activity[$heartbeatActivity->uaid] = $heartbeatActivity;
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HeartbeatMessagePool:: |
private | property | ||
HeartbeatMessagePool:: |
private static | property | ||
HeartbeatMessagePool:: |
public | function | addMessage(). | |
HeartbeatMessagePool:: |
public static | function | getInstance(). | |
HeartbeatMessagePool:: |
public | function | getMessage(). | |
HeartbeatMessagePool:: |
private | function | Constructor. |