public function onStompEvent(StompEvent $event) { $d = EventDispatcher::get(); // If the object does not have exactly one property then // it's invalid. if (!is_object($event->getData()) || count($event->getData()) !== 1) { // @todo Log this... return false; } // The event that will be dispatched $ordEvent = null; // We foreach over the single property object, because we don't // know the name of the property... foreach ($event->getData() as $k => $v) { switch ($k) { case "CA_MSG": case "CB_MSG": case "CC_MSG": case "CT_MSG": $ordEvent = new CClassEvent($v); break; case "SF_MSG": case "SG_MSG": case "SH_MSG": $ordEvent = new SClassEvent($v); break; default: // Unknown message type. // @todo Log this error. break; } } $d->dispatch(TopicEventNames::TRAIN_DESCRIBER, $ordEvent); }
public function onStompEvent(StompEvent $event) { $d = EventDispatcher::get(); // If there is no header property, then this Stomp message is // not valid, we can't process it. if (!is_object($event->getData()) || !property_exists($event->getData(), "header")) { // @todo Log this... return false; } // The event that will be returned. $ordEvent = new TrainMovementsEvent($event->getData()); $d->dispatch(TopicEventNames::TRAIN_MOVEMENTS, $ordEvent); }
public function onStompEvent(StompEvent $event) { $d = EventDispatcher::get(); $ordEvent = new VstpEvent($event->getData()); $d->dispatch(TopicEventNames::VSTP, $ordEvent); }