| 1 | <?php |
||
| 17 | class AssertingDispatcher implements Dispatcher |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var Dispatcher |
||
| 21 | */ |
||
| 22 | private $dispatcher; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var callable |
||
| 26 | */ |
||
| 27 | private $assertion; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param Dispatcher $dispatcher |
||
| 31 | * @param callable $assertion A callable that should throw an exception if the message shouldn't |
||
| 32 | * be dispatched. |
||
| 33 | */ |
||
| 34 | public function __construct(Dispatcher $dispatcher, callable $assertion) |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param object $message |
||
| 42 | * |
||
| 43 | * @return mixed |
||
| 44 | */ |
||
| 45 | public function dispatch(object $message) |
||
| 51 | } |
||
| 52 |