\Phabstractic\Patterns\ResourceStateInterface

State Interface

This was originally conceived for use in an 'event' system utilizing publisher/observer design pattern for primus/falcraft. This interface could also apply to anything that has a changing state, such as a finite state machine.

Following is the original documentation from primus/falcraft

This is used to represent an acceptable state object for a publisher. Any object that implements this interface is ready to be used in the publisher/observer pattern implemented in phabstractic

The idea is that a publishing object (publisher) has some form of state to it. When that state changes significantly (in other words when an observer might be interested) it triggers all its observers passing itself with it's state.

CHANGELOG

1.0: created StateInterface - August 16th, 2013 2.0: recreated for inclusion in Primus - April 2nd, 2015 3.0: reformatted for inclusion in phabstractic - July 26th, 2016

Summary

Methods
Constants
getState()
setState()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

getState()

getState() : mixed

Retrieve the State Object Data

Returns

mixed

setState()

setState(mixed  $stateData) 

Sets Object's State Data

In an 'event' publisher/observer ecosystem, such as asherwunk/phabstractic/-/event:

Replaces the current state object's data. In order for the observer/publisher pattern to work it is recommended that the caller of this function notifies all observers of the host object.

Parameters

mixed $stateData