\Horde_PubSub_Provider

Publish-Subscribe provider

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

Summary

Methods
Properties
Constants
publish()
subscribe()
unsubscribe()
getTopics()
getSubscribedHandles()
clearHandles()
No public properties found
No constants found
No protected methods found
$_topics
N/A
No private methods found
No private properties found
N/A

Properties

$_topics

$_topics : 

Subscribed topics and their handles

Type

Methods

publish()

publish(string  $topic, mixed  $args = null) : void

Publish to all handlers for a given topic

Parameters

string $topic
mixed $args

All arguments besides the topic are passed as arguments to the handler

subscribe()

subscribe(string  $topic, string|object  $context, null|string  $handler = null) : \Horde_PubSub_Handle

Subscribe to a topic

Parameters

string $topic
string|object $context

Function name, class name, or object instance

null|string $handler

If $context is a class or object, the name of the method to call

Returns

\Horde_PubSub_Handle

Pub-Sub handle (to allow later unsubscribe)

unsubscribe()

unsubscribe(\Horde_PubSub_Handle  $handle) : boolean

Unsubscribe a handler from a topic

Parameters

\Horde_PubSub_Handle $handle

Returns

boolean —

Returns true if topic and handle found, and unsubscribed; returns false if either topic or handle not found

getTopics()

getTopics() : array

Retrieve all registered topics

Returns

array

getSubscribedHandles()

getSubscribedHandles(string  $topic) : array

Retrieve all handlers for a given topic

Parameters

string $topic

Returns

array —

Array of Horde_PubSub_Handle objects

clearHandles()

clearHandles(string  $topic) : void

Clear all handlers for a given topic

Parameters

string $topic