getHandler() public method

Get the handler for the current event
public getHandler ( ) : string
return string
Example #1
0
 /**
  * Figure out which resources we have available and subscribe to them
  *
  * @param EventInterface $event
  */
 public function subscribe(EventInterface $event)
 {
     $resources = Resource::getAllResources();
     if ($this->params['additionalResources']) {
         $resources = array_merge($resources, $this->params['additionalResources']);
     }
     $events = [];
     foreach ($resources as $resource) {
         $events[$resource] = ['checkAccess' => 500];
     }
     $manager = $event->getManager();
     $manager->addCallbacks($event->getHandler(), $events);
 }
Example #2
0
File: Cors.php Project: ASP96/imbo
 /**
  * Subscribe to events based on configuration parameters
  *
  * @param EventInterface $event The event instance
  */
 public function subscribe(EventInterface $event)
 {
     $events = array();
     // Enable the event listener only for resources and methods specified
     foreach ($this->params['allowedMethods'] as $resource => $methods) {
         foreach ($methods as $method) {
             $eventName = $resource . '.' . strtolower($method);
             $events[$eventName] = array('invoke' => 1000);
         }
         // Always enable the listener for the OPTIONS method
         $eventName = $resource . '.options';
         $events[$eventName] = array('options' => 20);
     }
     $manager = $event->getManager();
     $manager->addCallbacks($event->getHandler(), $events);
     // Add OPTIONS to the Allow header
     $event->getResponse()->headers->set('Allow', 'OPTIONS', false);
 }
 /**
  * Subscribe to events based on configuration parameters
  *
  * @param EventInterface $event The event instance
  */
 public function subscribe(EventInterface $event)
 {
     $events = array_fill_keys(array_keys($this->params), 'queueRequest');
     $manager = $event->getManager();
     $manager->addCallbacks($event->getHandler(), $events);
 }