-
-
Save makasim/1172832 to your computer and use it in GitHub Desktop.
chain prototype
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
<?php | |
$exceptionFilter = new ExceptionFilterHandler(); | |
$exceptionFilter->allow('MyBundle\AbstractException') | |
->ignore('MyBundle\ConcreteException'); | |
$errorFilter = new ErrorFilterHandler(); | |
$errorFilter->allow(UniversalErrorCatcher_ErrorCode::E_CORE_ERROR) | |
->ignore(UniversalErrorCatcher_ErrorCode::E_ERROR); | |
$senderClient = new Swift(); | |
$senderAdapter = new SwiftAdapter($senderClient); | |
// OR | |
$senderClient = new Stomp(); | |
$senderAdapter = new JMSAdapter($senderClient); | |
$encoder = new HtmlEncoder(); | |
$sender = new SenderHandler($senderAdapter, $encoder); | |
$exceptionFilter->nextDestination($errorFilter)->nextDestination($sender); | |
instend of it | |
array_walk(array($exceptionFilter, $errorFilter, $sender), function($chainNode) use($dataHolder) { | |
$chainNode->execute($dataHolder); | |
}); | |
//to broke the execution we can throw a spesific exception. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment