$conf
$conf : \Phabstractic\Features\Zend\Config\Config
The objects configuration object
Should be an instance of Zend/Config
Event Filter Class - Defines basic event predicate
This object allows event handlers to filter what events they respond to. It sits in front of the event handler and when an event contains all the things (strictly) that the filter contains it is passed along to the handler
CHANGELOG
1.0 Created Event Filter - August 16th, 2013 2.0 Integrated with Primus 2 - October 13th, 2015 3.0: changed getTagsObject and getCategoriesObject to --Set reformatted for inclusion in phabstractic - July 29th, 2016
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 |
__construct(object $target = null, array $options = array())
The Filter Class Constructor
This builds a filter class with no state
Pass in a strict option to make an event match EVERYTHING in the filter object, rather than just one thing.
Options: strict - Strict Applicability
object | $target | The target of the event |
array | $options |
setState( $state)
State Interface Status Set
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.
$state |
setStateWithArray(array $state, boolean $morph = true)
This sets or morphs an event with new information
If morph is set, the event doesn't clear it's information, and instead overwrites whats already there.
$state must include identifier
array | $state | |
boolean | $morph | Whether we should replace or overwrite the object state |
setStateWithEvent(\Phabstractic\Event\Resource\EventInterface $state, boolean $morph = true)
This sets or morphs an event with new information
If morph is set, the event doesn't clear it's information, and instead overwrites whats already there.
\Phabstractic\Event\Resource\EventInterface | $state | |
boolean | $morph | Whether we should replace or overwrite the object state |
setStateWithFilter(\Phabstractic\Event\Resource\FilterInterface $filter, $morph = true)
Wrapper for setStateWithEvent
\Phabstractic\Event\Resource\FilterInterface | $filter | |
$morph |
build(object $target, string $function, string $class, string $namespace, mixed $data, array $tags = array(), array $cats = array())
Initialize the filter with values
This mimics the constructor to initialize the filter with the passed arguments
object | $target | |
string | $function | |
string | $class | |
string | $namespace | |
mixed | $data | |
array | $tags | |
array | $cats |
isEventApplicable(\Phabstractic\Event\Resource\EventInterface $event) : boolean
Figures what kind of testing we need
\Phabstractic\Event\Resource\EventInterface | $event |
isLooselyApplicable(\Phabstractic\Event\Resource\EventInterface $event) : boolean
Takes an event and compares it against the filter
If it matches on one account, the event is propagated
If this object is 'strict' we call strictlyApplicable instead
\Phabstractic\Event\Resource\EventInterface | $event |
isStrictlyApplicable(\Phabstractic\Event\Falcraft\Event\Resource\AbstractEvent $event, $includeIdentifier = false) : boolean
See if an event matches the filter exactly
If one thing doesn't match between the event and the filter then we return false, instead of only one thing matching
\Phabstractic\Event\Falcraft\Event\Resource\AbstractEvent | $event | The event to compare |
$includeIdentifier |