/** * Event which will be triggered * @param EventBeanProperty $event * @throws \Arthurh\Sphring\Exception\SphringEventListenerException */ public function onEvent($event) { parent::onEvent($event); if (!$this->object instanceof AbstractBeanProperty) { throw new SphringEventListenerException("Class '%s' must extends '%s'", get_class($this->object), AbstractBeanProperty::class); } $this->object->setSphring($this->sphringEventDispatcher->getSphring()); $this->object->setData($event->getData()); }
/** * Event which will be triggered * @param $event * @throws \Arthurh\Sphring\Exception\SphringEventListenerException */ public function onEvent($event) { if (!$event instanceof EventSphring) { throw new SphringEventListenerException("Event must be an '%s'", EventSphring::class); } parent::onEvent($event); if (!$this->object instanceof SphringGlobal) { throw new SphringEventListenerException("Class '%s' must extends '%s'", get_class($this->object), SphringGlobal::class); } $this->object->setSphring($this->sphringEventDispatcher->getSphring()); $this->object->run(); }
/** * Event which will be triggered * @param $event * @throws \Arthurh\Sphring\Exception\SphringEventListenerException */ public function onEvent($event) { if (!$event instanceof EventAnnotation) { throw new SphringEventListenerException("Event must be an EventAnnotation"); } parent::onEvent($event); if (!$this->object instanceof AbstractAnnotation) { throw new SphringEventListenerException("Class '%s' must extends '%s'", get_class($this->object), AbstractAnnotation::class); } $this->object->setBean($event->getBean()); $this->object->setData($event->getData()); $this->object->setEvent($event); $this->object->setSphringEventDispatcher($event->getSphringEventDispatcher()); $this->object->setReflector($event->getReflector()); $this->object->run(); }