\Phabstractic\Patterns\ResourceObserverInterface

Observer Interface - Identifies Many Different Objects As Notifiable

Any object that implements the notify function as specified below can be 'tagged' (interface) as able to be an observer.

This interface assumes that externals can 'attach' themselves to it. In the observer/publisher design pattern implementation found in phabstractic it is built so that both publishers and observers can register listeners/broacasters This can be utilized one-sided, or coupled together in implementation, whichever way is more conducive to the system.

CHANGELOG

1.0 created ObserverInterface - August 16th, 2013 2.0: reformatted for inclusion in phabstractic - July 26th, 2016

Summary

Methods
Constants
notifyObserver()
attachPublisher()
detachPublisher()
unlinkFromPublishers()
getPublishers()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

notifyObserver()

notifyObserver(\Phabstractic\Patterns\Resource\PublisherInterface  $publisher, \Phabstractic\Patterns\Resource\StateInterface  $state) 

When a state changes or something happens, this function is called

It accepts any capable publisher, and any capable state change information.

This for example is used in the universal event system, where state is the most recent event

Parameters

\Phabstractic\Patterns\Resource\PublisherInterface $publisher
\Phabstractic\Patterns\Resource\StateInterface $state

attachPublisher()

attachPublisher(\Phabstractic\Patterns\Resource\Phabstractic\Patterns\Resource\PublisherInterface  $publisher) 

Attach a publisher object to be listened to

Parameters

\Phabstractic\Patterns\Resource\Phabstractic\Patterns\Resource\PublisherInterface $publisher

detachPublisher()

detachPublisher(\Phabstractic\Patterns\Resource\Phabstractic\Patterns\Resource\PublisherInterface  $publisher) 

Detach an existing publisher object from being listened to

Parameters

\Phabstractic\Patterns\Resource\Phabstractic\Patterns\Resource\PublisherInterface $publisher

unlinkFromPublishers()

unlinkFromPublishers() 

Remove the observer from all registered publishers

getPublishers()

getPublishers() : array

Return array of publishers

Returns

array