$conf
$conf : \Phabstractic\Features\Zend\Config\Config
The objects configuration object
Should be an instance of Zend/Config
The Conduit Class
This class uses observer to collect a bunch of events from multiple sources and then employs a map (filters as keys, handlerpriorityqueues as values) to send those events to each filter to fire each handler chain.
CHANGELOG
1.0: Created Conduit Class - August 16th, 2013 1.1: Enabled Aggregator Injection - October 7th, 2013 2.0: Integrated into Primus 2 Changed filter concrete to FilterInterface - October 14th, 2015 3.0: implements configurationinterface eliminated need for aggregator, just implements observer now reformatted for inclusion in phabstarctic - July 31st, 2016
$observedSubjects : \Phabstractic\Patterns\Phabstractic\Patterns\Resource\PublisherInterface
The subjects that this observer is listening to
For an observer that listens to multiple publishers with some added functionality see Phabstractic\Event\Aggregator
configure(array|string|\Phabstractic\Features\Zend\Config\Config $configuration, string $format = null, mixed $context = null) : boolean
Configure An Object
Expects an array for configuration however, you can also pass it a filepath where it will read the information from a file automatically detecting the format using the file extension. You can also pass a Zend/Config object already made.
You can also pass a format specifier (forced format) for use in a if $configuration is a string formatted with such information. E.G. to load from a string in the format ini:
$this->configure($configString, 'ini');
The $context argument is used for any additional reader constructor information, such as the constructor for the 'yaml' format.
NOTE: You can override/extend the classes used for reading formats by identifying an additional array in the property $this->configReaders. This will merge with the standard formats array.
array|string|\Phabstractic\Features\Zend\Config\Config | $configuration | The objects configuration information. |
string | $format | The forced format, or format for configuration string |
mixed | $context | Any additional information for a reader constructor, such as needed for the YAML format. |
True if instantiated
saveSettings(string $file, \Phabstractic\Features\Zend\Config\Writer\WriterInterface $writer = null, boolean $exclusive = true, mixed $context = null)
Save an Object's Configuration to a File
Takes an objects $conf property and writes the information contained therein to a file with a format automatically specified by the filename.
It is possible to retrieve a string of a particular format from this method by specifying the filename '#string' with an extension indicating the desired format, such as '#string.json'.
The $context argument is used for any additional reader constructor information, such as the constructor for the 'yaml' format.
NOTE: You can override/extend the classes used for writing formats by identifying an additional array in the property $this->configWriters. This will merge with the standard formats array.
string | $file | The file path to write to, or '#string.ext' |
\Phabstractic\Features\Zend\Config\Writer\WriterInterface | $writer | The optional writer object supplied to use (such as a MySQL writer) |
boolean | $exclusive | Argument provided to toFile(), file exclusive lock when writing |
mixed | $context | Any additionla writer constructor information (YAML) |
getSettings(string $format, $context = null) : string|boolean
Retrieve an Object's Configuration Information As String
This is a shortcut to ::saveSettings() which specifies a format and forces the return of a string, using the #string.ext filename -see documentation for ::saveSettings()-
string | $format | The format to return, must be supported by ::saveSettings(), use $this->configWriters to support additional formats. |
$context |
The formatted string, or false otherwise
processSettings(\Phabstractic\Features\Zend\Config\Processor\ProcessorInterface $processor)
Process an Object's Configuration
This uses a Zend\Config\Processor implementation to process the configuration information, such as constants. The processor must be supplied and implement ProcessorInterface
NOTE: Edits the $conf object in place.
\Phabstractic\Features\Zend\Config\Processor\ProcessorInterface | $processor | The given processor object |
detachPublisher(\Phabstractic\Patterns\Resource\PublisherInterface $publisher)
This detaches the observer from its subject
Reciprocal methods exist in the publisher
\Phabstractic\Patterns\Resource\PublisherInterface | $publisher |
attachPublisher(\Phabstractic\Patterns\Resource\PublisherInterface $publisher)
Attach this observer to a new publisher
This also acts like a 'set' function, and null is an acceptable value to be passed
\Phabstractic\Patterns\Resource\PublisherInterface | $publisher |
notifyObserver(\Phabstractic\Patterns\Resource\PublisherInterface $publisher, \Phabstractic\Patterns\Resource\StateInterface $state) : boolean
The aggregate will call this class when it fires.
When a state change occurs and the notify function is called, we first make sure it's an abstract event, otherwise we exit gracefully, and then we run it through the various filters and their event chains. Events are handled as references so they can be affected by the handlers they encounter (or filters, or conduits, etc)
\Phabstractic\Patterns\Resource\PublisherInterface | $publisher | |
\Phabstractic\Patterns\Resource\StateInterface | $state |
true if handled (is AbstractEvent)
__construct(array $filters = array(), array $options = array())
The Conduit Constructor
This takes an array of filters to set up the map
This can be a multidimensional array where 0 is the filter and 1 is the priority queue Or it can just be a filter object, in which case an empty priority queue is instantiated
array | $filters | |
array | $options |
addFilter(\Phabstractic\Event\Resource\FilterInterface $filter)
Add a filter to the list of filters
Instantiates with an empty priority queue
\Phabstractic\Event\Resource\FilterInterface | $filter |
setFilter(\Phabstractic\Event\Falcraft\Event\Resource\Filter $filter, \Phabstractic\Event\Falcraft\Event\Resource\HandlerPriorityQueue $queue)
Associate a given filter, in the map, with a given priority queue
\Phabstractic\Event\Falcraft\Event\Resource\Filter | $filter | The filter to set |
\Phabstractic\Event\Falcraft\Event\Resource\HandlerPriorityQueue | $queue | The given queue to be used |
getHandlerPriorityQueue(\Phabstractic\Event\Phabstractic\Event\Filter $filter) : \Phabstractic\Event\Phabstractic\Event\HandlerPriorityQueue
Retrieve HandlerPriorityQueue associated to given filter
\Phabstractic\Event\Phabstractic\Event\Filter | $filter |
getHandlerPriorityQueueReference(\Phabstractic\Event\Phabstractic\Event\Filter $filter) : \Phabstractic\Event\Phabstractic\Event\HandlerPriorityQueue
Retrieve HandlerPriorityQueue associated to given filter as reference
\Phabstractic\Event\Phabstractic\Event\Filter | $filter |