Callback for 'routesTrigger' event.

@param ModuleEvent $e

@throws \Exception if the module returns an invalid route type

@return $this
1314
public function routesTrigger(ModuleEvent $e)
    {
        $module = $e->getModule();

        if (is_callable(array($module, 'getRoutes'))) {
            $routes = $module->getRoutes();
            $this->routes[$e->getModuleName()] = $routes;
        }

        return $this;
    }
733509
public function onBootstrap(EventInterface $e)
    {
        /** @var MvcEvent $e */
        $eventManager        = $e->getApplication()->getEventManager();
        $moduleRouteListener = new ModuleRouteListener();
        $moduleRouteListener->attach($eventManager);

        /** @var Workflow $workflowService */
        $workflowService = $e->getApplication()->getServiceManager()->get(Workflow::class);
        $listener = $e->getApplication()->getServiceManager()->get(InjectTypeResolver::class);
        $workflowService->getEventManager()->attach($listener);
    }
280098
public function setupModuleOptionsEventParam(MvcEvent $e)
    {
        $services = $e->getApplication()->getServiceManager();
        $config = $services->get('Config');
        if (empty($config[static::OPTIONS_CONFIG_KEY])) {
            return;
        }

        $routeMatch = $e->getRouteMatch();
        $moduleNamespace = $routeMatch->getParam(
            ModuleRouteListener::MODULE_NAMESPACE,
            $routeMatch->getParam('controller')
        );

        $module = strstr($moduleNamespace, '\\', true);

        foreach ($config[static::OPTIONS_CONFIG_KEY] as $suffix) {
            $name = "$module\\$suffix";
            if ((class_exists($name) || interface_exists($name)) && $services->has($name)) {
                $moduleOptions = $services->get($name);
                if ($moduleOptions instanceof AbstractOptions) {
                    //set module options as MvcEvent param
                    $e->setParam('module-options', $moduleOptions);
                }

                break;
            }
        }
    }
1304577
public function routeTo(string $method, string $path, ...$args)
    {
        $event = strtoupper($method).' '.$path;

        $this
            ->getRouter()
            ->getEventHandler()
            ->trigger($event, ...$args);

        return $this;
    }
1181382
public function onMergeConfig(\Zend\ModuleManager\ModuleEvent $e)
    {
        $config = $e->getConfigListener()->getMergedConfig(false);

        if (isset($config['playgroundLocale']) && isset($config['playgroundLocale']['enable']) && $config['playgroundLocale']['enable']) {
            $config['router']['routes']['frontend']['options']['route'] = '/[:locale[/]]';
            $config['router']['routes']['frontend']['options']['constraints']['locale'] = '[a-z]{2}([-_][A-Z]{2})?(?=/|$)';
            $config['router']['routes']['frontend']['options']['defaults']['locale'] = $config['playgroundLocale']['default'];
        }

        $e->getConfigListener()->setMergedConfig($config);
    }
421594
public function onKernelController(FilterControllerEvent $event)
    {
        $request = $event->getRequest();
        $route = $this->routes->get($request->attributes->get('_route'));
        if ($route && $converters = $route->getOption('_converters')) {
            foreach ($converters as $name => $callback) {
                $callback = $this->callbackResolver->resolveCallback($callback);

                $request->attributes->set($name, call_user_func($callback, $request->attributes->get($name), $request));
            }
        }
    }
271943
public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt)
    {
        $transportName = get_class($evt->getSource());
        $this->logger->add(sprintf('++ Starting %s', $transportName));
    }
519175
public function handle(Exception $e)
    {
        foreach ($this->handlers as $handler) {
            if ($handler->manages($e)) {
                return $handler->handle($e);
            }
        }

        throw new RuntimeException('Exception handler for '.get_class($e).' not found.');
    }
426006
public function onDispatch(MvcEvent $e)
    {
        try {
            parent::onDispatch($e);
        } catch (\Exception $e) {
            return $this->getResponse()->setStatusCode(500)->setContent($e->__toString());
        }
    }
808006
public function onException(RouteExceptionEvent $event) {
    $exception = $event->getException();
    $handler = \Drupal::service('acm_exception.route_exception_handler');
    $handler->message($exception);
    $handler->log($exception);
  }
741006
public function onKernelController(FilterControllerEvent $event): void
    {
        $controller = $event->getController();
        if (\is_array($controller)) {
            [$controller] = $controller; // Ignoring action
        }
        if (!$controller instanceof AdminInjectableInterface && !$controller instanceof ActionInjectableInterface) {
            return;
        }

        $request = $event->getRequest();
        if (!$request->attributes->has('_admin')) {
            $routeName = $request->attributes->get('_route');

            $m = "Missing request attribute '_admin' for route {$routeName}, this means you declared";
            $m .= ' this route outside the admin configuration, please use the admin configuration';
            throw new \LogicException($m);
        }
        $admin = $request->attributes->get('_admin');
        if (!$admin instanceof Admin) {
            throw new \UnexpectedValueException('_admin request attribute is not an Admin object');
        }
        if ($controller instanceof AdminInjectableInterface) {
            $controller->setAdmin($admin);
        }

        if (!$request->attributes->has('_action')) {
            $routeName = $request->attributes->get('_route');

            $m = "Missing request attribute '_action' for route {$routeName},";
            $m .= 'this means you declared this route outside the admin configuration, please include the _action';
            $m .= 'attribute in your route definition or use the admin configuration';
            throw new \LogicException($m);
        }
        $admin->setCurrentAction($request->attributes->get('_action'));
        if ($controller instanceof ActionInjectableInterface) {
            $controller->setAction($admin->getCurrentAction());
        }
    }
90212
public function handleException($e)
    {
        if (!isset($this->route)) {
            return false;
        }
        return $this->route->handleException($e);
    }
1048525
public function setEventTrigger(EventTriggerInterface $eventTrigger)
    {
        $this->init();
        $eventService = new EventTriggerService();
        $eventService->registerEventDispatcher($eventTrigger);

        $this->container->instance(EventTriggerService::class, $eventService);
    }
1155145
public function onBootstrap(EventInterface $e)
    {
        if (!$e instanceof MvcEvent) {
            $errMsg = sprintf('Event not implement %s', MvcEvent::class);
            throw new Exception\InvalidArgumentException($errMsg);
        }

        $app = $e->getApplication();

        $eventManager        = $app->getEventManager();
        $moduleRouteListener = new ModuleRouteListener();
        $moduleRouteListener->attach($eventManager);

        $sl = $app->getServiceManager();
        /** @var ParamsFromDoctrineModuleListener $paramsFromDoctrineModuleListener */
        $paramsFromDoctrineModuleListener = $sl->get(ParamsFromDoctrineModuleListener::class);
        $paramsFromDoctrineModuleListener->attach($eventManager);


        /** @var ResolverManagerRegistryResourceListener $resolverManagerRegistryResourceListener */
        $resolverManagerRegistryResourceListener = $sl->get(ResolverManagerRegistryResourceListener::class);
        $resolverManagerRegistryResourceListener->attach($eventManager);

        /** @var ManagerRegistryListener $managerRegistryListener */
        $managerRegistryListener = $sl->get(ManagerRegistryListener::class);
        $managerRegistryListener->attach($eventManager);

    }
791501
public function onBootstrap(EventInterface $e)
    {
        /* @var $e \Zend\Mvc\MvcEvent */
        $serviceManager = $e->getApplication()->getServiceManager();
        /* @var $serviceManager \Zend\ServiceManager\ServiceManager */

        $this->initPluginManagerFactory(
            $serviceManager,
            __NAMESPACE__ . '\SupervisorManager',
            'supervisor_plugin_manager'
        );

        $this->initPluginManagerFactory(
            $serviceManager,
            __NAMESPACE__ . '\ListenerManager',
            'listener_plugin_manager'
        );
    }
1200135
public function onRoute(MvcEvent $event)
    {
        /* @var $service \BjyAuthorize\Service\Authorize */
        $service    = $this->serviceLocator->get('BjyAuthorize\Service\Authorize');
        $match      = $event->getRouteMatch();
        $routeName  = $match->getMatchedRouteName();

        if ($service->isAllowed('route/' . $routeName)) {
            return;
        }

        $event->setError(static::ERROR);
        $event->setParam('route', $routeName);
        $event->setParam('identity', $service->getIdentity());
        $event->setParam('exception', new UnAuthorizedException('You are not authorized to access ' . $routeName));

        /* @var $app \Zend\Mvc\Application */
        $app = $event->getTarget();

        $app->getEventManager()->trigger(MvcEvent::EVENT_DISPATCH_ERROR, $event);
    }
443412
public function getServicesTrigger(ModuleEvent $e)
    {
        $module = $e->getModule();

        if (method_exists($module, 'getServiceConfig') && is_callable(array($module, 'getServiceConfig'))) {
            $services = $module->getServiceConfig();
            if (is_array($services) && isset($services['factories'])) {
                $this->services[$e->getModuleName()] = $services['factories'];
            }
        }

        return $this;
    }