コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function subscribe(SubscriberInterface $subscriber)
 {
     foreach ($subscriber->getSubscriptions() as $subscription) {
         $this->eventDispatcher->addListener($subscription[0], function (GenericEvent $event) use($subscription) {
             call_user_func($subscription[1], $event->getSubject());
         }, isset($subscription[2]) ? $subscription[2] : 0);
     }
     return $this;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function subscribe(SubscriberInterface $subscriber)
 {
     foreach ($subscriber->getSubscriptions() as $subscription) {
         $this->eventManager->attach($subscription[0], function (Event $event) use($subscription) {
             call_user_func($subscription[1], $event->getTarget());
         }, isset($subscription[2]) ? $subscription[2] : 0);
     }
     return $this;
 }