Horde_PubSub
in package
Publish-Subscribe system
Tags
Table of Contents
- $_topics : mixed
- Subscribed topics and their handles
- clearHandles() : void
- Clear all handlers for a given topic
- getSubscribedHandles() : array<string|int, mixed>
- Retrieve all handlers for a given topic
- getTopics() : array<string|int, mixed>
- Retrieve all registered topics
- publish() : void
- Publish to all handlers for a given topic
- subscribe() : Horde_PubSub_Handle
- Subscribe to a topic
- unsubscribe() : bool
- Unsubscribe a handler from a topic
Properties
$_topics
Subscribed topics and their handles
protected
static mixed
$_topics
= array()
Methods
clearHandles()
Clear all handlers for a given topic
public
static clearHandles(string $topic) : void
Parameters
- $topic : string
Return values
void —getSubscribedHandles()
Retrieve all handlers for a given topic
public
static getSubscribedHandles(string $topic) : array<string|int, mixed>
Parameters
- $topic : string
Return values
array<string|int, mixed> —Array of Horde_PubSub_Handle objects
getTopics()
Retrieve all registered topics
public
static getTopics() : array<string|int, mixed>
Return values
array<string|int, mixed> —publish()
Publish to all handlers for a given topic
public
static publish(string $topic[, mixed $args = null ]) : void
Parameters
- $topic : string
- $args : mixed = null
-
All arguments besides the topic are passed as arguments to the handler
Return values
void —subscribe()
Subscribe to a topic
public
static subscribe(string $topic, string|object $context[, null|string $handler = null ]) : Horde_PubSub_Handle
Parameters
- $topic : string
- $context : string|object
-
Function name, class name, or object instance
- $handler : null|string = null
-
If $context is a class or object, the name of the method to call
Return values
Horde_PubSub_Handle —Pub-Sub handle (to allow later unsubscribe)
unsubscribe()
Unsubscribe a handler from a topic
public
static unsubscribe(Horde_PubSub_Handle $handle) : bool
Parameters
- $handle : Horde_PubSub_Handle
Return values
bool —Returns true if topic and handle found, and unsubscribed; returns false if either topic or handle not found