Handle an event.

@param \League\Event\EventInterface $event The triggering event

@return void
@see \League\Event\ListenerInterface::handle()
160921
public function handle(EventInterface $event)
    {

        try {
            // load the application server instance
            /** @var \AppserverIo\Psr\ApplicationServer\ApplicationServerInterface $applicationServer */
            $applicationServer = $this->getApplicationServer();

            // write a log message that the event has been invoked
            $applicationServer->getSystemLogger()->info($event->getName());

            // print a message with the old UID/EUID
            $applicationServer->getSystemLogger()->info("Running as " . posix_getuid() . "/" . posix_geteuid());

            // extract the variables
            $uid = 0;
            extract(posix_getpwnam('root'));

            // switcht the effective UID to the passed user
            if (posix_seteuid($uid) === false) {
                $applicationServer->getSystemLogger()->error(sprintf('Can\'t switch UID to \'%s\'', $uid));
            }

            // print a message with the new UID/EUID
            $applicationServer->getSystemLogger()->info("Running as " . posix_getuid() . "/" . posix_geteuid());

            // @TODO Switch group also!!!!

        } catch (\Exception $e) {
            $applicationServer->getSystemLogger()->error($e->__toString());
        }
    }
297133
public function deleteImage(EventInterface $event) {
        $request = $event->getRequest();

        $event->getDatabase()->deleteImage(
            $request->getUser(),
            $request->getImageIdentifier()
        );
    }
26103
public function queueEvent($event)
    {
        $this->queue->enqueue($event);

        $class = get_class($event);
        foreach ($this->synchronousEventMap->getListenersForEvent($class) as $listener)
        {
            $this->invokeListener($listener, $event);
        }
    }
31907
public function handle($event)
    {
        if ($event instanceof RouteMatched) {
            $this->handleLaravelRoute($event);
        }

        if ($event instanceof GzeroRouteMatched) {
            $this->handleRoute($event);
        }
    }
687354
public function handle(EventInterface $event)
    {

        try {
            // load the application server and system configuration instance
            /** @var \AppserverIo\Psr\ApplicationServer\ApplicationServerInterface $applicationServer */
            $applicationServer = $this->getApplicationServer();
            /** @var \AppserverIo\Psr\ApplicationServer\Configuration\SystemConfigurationInterface $systemConfiguration */
            $systemConfiguration = $applicationServer->getSystemConfiguration();

            // load the initial context configuration
            /** @var \AppserverIo\Psr\ApplicationServer\Configuration\InitialContextConfigurationInterface $initialContextNode */
            $initialContextNode = $systemConfiguration->getInitialContext();
            $reflectionClass = new \ReflectionClass($initialContextNode->getType());
            /** @var \AppserverIo\Psr\ApplicationServer\ContextInterface $initialContext */
            $initialContext = $reflectionClass->newInstanceArgs(array($systemConfiguration));

            // attach the registered loggers to the initial context
            $initialContext->setLoggers($applicationServer->getLoggers());
            $initialContext->setSystemLogger($applicationServer->getSystemLogger());

            // set the initial context and flush it initially
            $applicationServer->setInitialContext($initialContext);

        } catch (\Exception $e) {
            $applicationServer->getSystemLogger()->error($e->__toString());
        }
    }
1345350
public function delete(EventInterface $event) {
        $event->getManager()->trigger('db.metadata.delete');
        $event->getResponse()->setModel(new Model\Metadata());
    }
881764
function handle(Event $event)
    {
        if ($this->accept($event)) {
            $this->onEvent($event);
            return true;
        }

        return false;
    }
721267
public function post(EventInterface $event) {
        $request = $event->getRequest();

        $event->getManager()->trigger('db.metadata.update', [
            'metadata' => json_decode($request->getContent(), true),
        ]);

        $model = new Model\Metadata();
        $model->setData($event->getDatabase()->getMetadata($request->getUser(), $request->getImageIdentifier()));

        $event->getResponse()->setModel($model);
    }
1340925
public function dispatch(Event $event) {

		$this->lastEvent = $event;
		$eventName = $event->getName();

		if (isset($this->registry[$eventName])) {

			foreach ($this->getSortedRegistry($eventName) as $listener) {
				call_user_func($listener, $event);
			}
			
		}

	}
1202418
public function handle(ActionInterface $event)
    {
        $data = $event->getAction();

        $action = [
            'class_name'  => get_class($event),
            'user_id'     => $data['user']->id,
            'username'    => $data['user']->username,
            'description' => $data['description'],
        ];

        if (isset($data['information'])) {
            $action['information'] = $data['information'];
        }

        Action::create($action);
    }
485387
public function handle($event)
    {
        $method = $this->getMethodFor($event);

        if (method_exists($this, $method)) {
            return call_user_func([$this, $method], $event);
        }
    }
735100
public function sendResponse(ResponseInterface $response) : void
    {
        if (!headers_sent()) {
            $this->sendStatusLine($response);
            $this->sendHeaders($response);
        }
        $this->eventDispatcher->dispatch(new EventAfterAppReponseHeadersSending($response));
        $this->sendBody($response);
    }
947632
public function handle(Event $event)
    {
        $name = $event->getName();
        list(, $method) = explode('.', $name);
        if (empty($this->_config['for']) && empty($this->_config['when'])) {
            return $this->{$method}($event);
        }
        if ($this->matches($event)) {
            return $this->{$method}($event);
        }
    }
444634
public function dispatch(EventInterface $event) : void
    {
        $eventName = $event->getName();
        $listeners = $this->dispatcher->getListeners($eventName);
        foreach ($listeners as $listener) {
            if (is_callable($listener)) {
                try {
                    $listener($event);
                } catch (\Throwable $e) {
                    throw new \InvalidArgumentException(
                        "Invalid callable as listener provided for event '{$eventName}',"
                        ." and it cannot be executed",
                        null,
                        $e
                    );
                }
            } else {
                try {
                    $listenerInstance = $this->getResolver()->get($listener);
                } catch (\Throwable $e) {
                    throw new ContainerServiceNotFound(
                        "Invalid service as listener '{$listener}' provided for event"
                        ." '{$eventName}', and it cannot be resolved",
                        null,
                        $e
                    );
                }
                if (!$listenerInstance instanceof ListenerInterface) {
                    throw new \InvalidArgumentException(
                        "Invalid service as listener '{$listener}' provided for event"
                        ." '{$eventName}', expected \Duktig\Core\Event\ListenerInterface"
                    );
                }
                $listenerInstance->handle($event);
            }
        }
    }
452413
public function handleEvent($event, array $args)
    {
        $logger = $this->getLogger();

        $eventObjects = array_filter($args, function($arg) {
            return $arg instanceof EventInterface;
        });
        if (!$eventObjects) {
            $logger->info('Event emitted without EventInterface argument', array(
                'event' => $event,
                'args' => $args,
            ));
        } else {
            $eventObject = reset($eventObjects);
            if ($this->filter->filter($eventObject) === false) {
                $logger->info('Event did not pass filter, skipping', array(
                    'event' => $event,
                    'args' => $args,
                ));
                return;
            } else {
                $logger->info('Event passed filter, forwarding', array(
                    'event' => $event,
                    'args' => $args,
                ));
            }
        }

        $callbacks = $this->getEventHandlers($event);
        foreach ($callbacks as $callback) {
            $logger->info('Forwarding event to callback', array(
                'event' => $event,
                'args' => $args,
                'callback' => $callback,
            ));
            call_user_func_array($callback, $args);
        }
    }
127443
public function handle(UpdatedEvent $event)
    {
        if ($event->oldemail === $event->user->email) {
            $data = sprintf('**Verified:** _<%s>_', $event->user->email);
        } else {
            $data = implode("\n", [
                sprintf('**Updated:** _<%s>_', $event->user->email),
                sprintf('**Old:** _<%s>_', $event->oldemail),
            ]);
        }

        $this->track(Settings::TYPEID_UPDATED, $event->user->id, 25, $data);
    }
694842
public function handle(EventInterface $event)
    {

        try {
            // load the application server and the naming directory instance
            /** @var \AppserverIo\Psr\ApplicationServer\ApplicationServerInterface $applicationServer */
            $applicationServer = $this->getApplicationServer();

            // write a log message that the event has been invoked
            $applicationServer->getSystemLogger()->info($event->getName());

            // add the configured extractors to the internal array
            /** @var \AppserverIo\Appserver\Core\Api\Node\ScannerNodeInterface $scannerNode */
            foreach ($applicationServer->getSystemConfiguration()->getScanners() as $scannerNode) {
                // load the factory class name
                $factoryClass = $scannerNode->getFactory();

                // invoke the visit method of the factory class
                /** @var \AppserverIo\Appserver\Core\Scanner\ScannerFactoryInterface $factory */
                $factoryClass::visit($applicationServer, $scannerNode);
            }

        } catch (\Exception $e) {
            $applicationServer->getSystemLogger()->error($e->__toString());
        }
    }