Skip to content

Instantly share code, notes, and snippets.

@trq
Created December 10, 2012 11:47
Show Gist options
  • Save trq/4250162 to your computer and use it in GitHub Desktop.
Save trq/4250162 to your computer and use it in GitHub Desktop.
abstract class ChainEventAbstract implements ChainEventInterface
{
/**
* Define the method to be called on the way into the filter.
*
* @param Proem\Service\AssetManagerInterface $assets
*/
abstract public function in(AssetManagerInterface $assets);
/**
* Define the method to be called on the way out of the filter.
*
* @param Proem\Service\AssetManagerInterface $assets
*/
abstract public function out(AssetManagerInterface $assets);
/**
* Bootstrap this event.
*
* Executes in() then init() on the next event= in the filter chain
* before returning to execute out().
*
* @param Proem\Filter\ChainManagerInterface $chainManager
* @param array Optional extra parameters.
*/
public function init(ChainManagerInterface $chainManager, array $params = [])
{
$this->in($chainManager->getAssetManager());
if ($chainManager->getQueue()->valid()) {
$event = $chainManager->getQueue()->next();
if (is_object($event)) {
$event->init($chainManager);
}
}
$this->out($chainManager->getAssetManager());
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment