Created
December 10, 2012 11:47
-
-
Save trq/4250162 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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