Documentation

Horde_PubSub_Provider
in package

Publish-Subscribe provider

Use Horde_PubSub_Provider when you want to create a per-instance plugin system for your objects.

Tags
category

Horde

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 mixed $_topics = array()

Methods

clearHandles()

Clear all handlers for a given topic

public clearHandles(string $topic) : void
Parameters
$topic : string
Return values
void

getSubscribedHandles()

Retrieve all handlers for a given topic

public 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 getTopics() : array<string|int, mixed>
Return values
array<string|int, mixed>

publish()

Publish to all handlers for a given topic

public 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 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 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

Search results