/** * {@inheritdoc} */ public function dispatchNow(MessageInterface $message) { if ($this->gate->has(BusInterface::SYSTEM_BUS)) { $this->dispatchSystemMessage($message); } return $this->bus->dispatchNow($message); }
/** * Assert valid system bus. * * @param BusInterface $bus */ private function assertValidSystemBus(BusInterface $bus) { if (false === $bus instanceof SystemBus) { throw new InvalidArgumentException(sprintf('Bus with name "%s" reserved for system bus.', $bus->getName())); } }