Adds all the request attributes to the parameters.

@param \eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent $e
185348
public function addRequestAttributes(FilterViewBuilderParametersEvent $e)
    {
        $parameterBag = $e->getParameters();
        $parameterBag->add($e->getRequest()->attributes->all());

        // maybe this should be in its own listener ? The ViewBuilder needs it.
        if (!$parameterBag->has('viewType')) {
            $parameterBag->add(['viewType' => null]);
        }
    }
740280
protected function addError(Exception $e) {
        $errors = $this->getErrors();
        $errors[] = $e;
        $this->setErrors($errors);
    }
289201
public function onFilterBuilderPrepare(PrepareEvent $event)
    {
        $qb = $event->getQueryBuilder();

        $queryClasses = array(
            'Doctrine\ORM\QueryBuilder'          => 'Lexik\Bundle\FormFilterBundle\Filter\Doctrine\ORMQuery',
            'Doctrine\DBAL\Query\QueryBuilder'   => 'Lexik\Bundle\FormFilterBundle\Filter\Doctrine\DBALQuery',
            'Doctrine\ODM\MongoDB\Query\Builder' => 'Lexik\Bundle\FormFilterBundle\Filter\Doctrine\MongodbQuery',
        );

        foreach ($queryClasses as $builderClass => $queryClass) {
            if (class_exists($builderClass) && $qb instanceof $builderClass) {
                $query = new $queryClass($qb, $this->getForceCaseInsensitivity($qb), $this->encoding);

                $event->setFilterQuery($query);
                $event->stopPropagation();

                return;
            }
        }
    }
1310703
public function onBootstrap(MvcEvent $e)
    {
        // we attach with wildcard events name
        $events = $e->getApplication()->getEventManager();
        $events->attach(
            MvcEvent::EVENT_RENDER,
            new InjectSubNavigationListener(),
            10
        );
    }
1138897
public function onKernelRequest(GetResponseEvent $event): void
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        $request = $event->getRequest();
        $attributes = $request->attributes;
        if ($attributes->get(SetIsApiRequestListener::API_FLAG_NAME) !== true) {
            return;
        }

        if (!$attributes->has('itemType')) {
            return;
        }

        $config = $this->loadConfig($attributes->get('itemType'));

        $customParams = $request->query->get('customParams', []);
        if (!is_array($customParams)) {
            throw new RuntimeException(
                sprintf(
                    'Invalid custom parameters specification for "%s" item type.',
                    $attributes->get('itemType')
                )
            );
        }

        $config->addParameters($customParams);

        $configLoadEvent = new ConfigLoadEvent($config);

        Kernel::VERSION_ID >= 40300 ?
            $this->eventDispatcher->dispatch($configLoadEvent, ContentBrowserEvents::CONFIG_LOAD) :
            $this->eventDispatcher->dispatch(ContentBrowserEvents::CONFIG_LOAD, $configLoadEvent);

        $this->container->set('netgen_content_browser.current_config', $config);
    }
589213
function setActionParameter( $parameterName, $parameterValue, $view = '' )
    {
        if ( $view == '' )
            $view = self::currentView();
        $this->ViewActionParameters[$view][$parameterName] = $parameterValue;
    }
298403
public function onRenderView(CollectViewParametersEvent $event): void
    {
        $currentRequest = $this->requestStack->getCurrentRequest();
        if (!$currentRequest instanceof Request) {
            return;
        }

        $view = $event->getView();
        if (!$view instanceof BlockViewInterface || !$view->hasParameter('collection_identifier')) {
            return;
        }

        if (!in_array($view->getContext(), $this->enabledContexts, true)) {
            return;
        }

        $block = $view->getBlock();

        $collectionIdentifier = $view->getParameter('collection_identifier');

        $resultPager = $this->pagerFactory->getPager(
            $block->getCollection($collectionIdentifier),
            $currentRequest->query->getInt('page', 1),
            $this->getMaxPages($block)
        );

        $event->addParameter('collection', $resultPager->getCurrentPageResults());
        $event->addParameter('pager', $resultPager);
    }
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'
        );
    }
1371646
protected function applyParameters($query)
    {
        $this->storeGlobalSettings();

        $strategies = $this->buildStrategies();

        foreach ($this->data->getApplicableAttributes() as $parameterName) {

            // should we skip it no matter what?
            if ($this->isParameterIgnored($parameterName)) continue;

            // get the value for the filter parameter
            // and if it is empty, we're not filtering by it and should skip it
            $parameterValue = $this->data->getParameterValue($parameterName);

            if ($this->isParameterValueUnset($parameterName, $parameterValue)) continue;


            // find the strategy to be used for applying the filter for this parameter
            // then normalize the strategy so that we can call_user_func on it

            $strategy = isset($strategies[$parameterName]) ? $strategies[$parameterName] : null;

            // is it a global setting, not a normal parameter? skip it
            if ($strategy === static::SETTING) continue;


            if (is_a($strategy, ParameterFilterInterface::class)) {

                $strategy = [ $strategy, 'apply' ];

            } elseif (is_null($strategy)) {
                // default, let it be handled by applyParameter

                $strategy = [ $this, 'applyParameter' ];

            } elseif ( ! is_callable($strategy) && ! is_array($strategy)) {

                throw new ParameterStrategyInvalidException(
                    "Invalid strategy defined for parameter '{$parameterName}',"
                    . " must be ParameterFilterInterface, classname, callable or null"
                );
            }

            // apply the strategy
            call_user_func_array($strategy, [ $parameterName, $parameterValue, $query, $this ]);
        }
    }
98817
public function setAssets(MvcEvent $e)
    {
        /* @var AssetsServiceInterface $assetsService */
        $assetsService = $e->getApplication()->getServiceManager()->get('AcAssets\Service\AssetsService');
        $assetsService->initHeadLink()
                      ->initHeadScript()
                      ->initInlineScript();
    }
628259
public function onKernelControllerArguments(FilterControllerArgumentsEvent $event): void
    {
        $arguments = $event->getArguments();

        foreach ($arguments as $argument) {
            if ($argument instanceof ResourceInterface) {
                $violationList = $this->validator->validate($argument);

                if (count($violationList)) {
                    throw ViolationListException::create($violationList);
                }
            }
        }
    }
665576
public function addParameter($param, $value = true)
  {
    if (!is_scalar($param))
    {
      throw new \Exception("Parameter filter must be scalar");
    }

    if (!isset($this->parameters))
    {
      $this->parameters = [];
    }

    return $this->addGetParam($param, $value);
  }
578198
public function onDispatch(\Zend\Mvc\MvcEvent $e)
    {
        $routeMatch = $e->getRouteMatch();
        $action     = $this->params()->fromQuery('action');
        
        if ($routeMatch && $action) {
            $routeMatch->setParam('action', $action);
        }

        return parent::onDispatch($e);
    }
1294256
public function handle(StartEventParam $e)
    {
        Imi::setProcessName('master');
        echo 'Server start', PHP_EOL;
        $mainSwooleServer = ServerManage::getServer('main')->getSwooleServer();
        echo 'WorkerNum: ', $mainSwooleServer->setting['worker_num'], ', TaskWorkerNum: ', $mainSwooleServer->setting['task_worker_num'], PHP_EOL;
        foreach(ServerManage::getServers() as $server)
        {
            if($server->isSubServer())
            {
                $serverPort = $server->getSwoolePort();
            }
            else
            {
                $serverPort = $server->getSwooleServer();
            }
            echo '[', $server->getConfig()['type'], '] ', $server->getName(), '; listen: ', $serverPort->host, ':', $serverPort->port, PHP_EOL;
        }
    }
925637
public function setDateFormat(Event $e)
    {
        /* @var EventsForm $form */
        $form = $e->getParam('form');
        /* @var EventsHydrator $hydrator */
        $hydrator = $form->getHydrator();
        /* @var DateTime $dateTimeStrategy */
        $dateTimeStrategy = $hydrator->getStrategy('dateTime');
        $dateTimeStrategy->setHydrateFormat($this->getOptions()->getDateFormat());
    }
391822
public function injectResponse(ViewEvent $e)
    {
        $model = $e->getModel();
        if (!$model instanceof ApiProblemModel) {
            // Model is not an ApiProblemModel; we cannot handle it here
            return null;
        }

        /** @var Request $request */
        $request = $e->getRequest();

        /** @var Accept $accept */
        $accept = $request->getHeader('Accept');

        if (!($accept instanceof Accept && $accept->hasMediaType('text/xml'))) {
            return null;
        }

        $problem     = $model->getApiProblem();
        $statusCode  = $this->getStatusCodeFromApiProblem($problem);
        $contentType = 'text/xml';

        /** @var Response $response */
        $response = $e->getResponse();

        $problemData = $problem->toArray();
        $xmlWriter = new XmlWriter();

        $output = $xmlWriter->processConfig($problemData);


        $response->setStatusCode($statusCode);
        $response->setContent($output);
        $headers = $response->getHeaders();
        $headers->addHeaderLine('Content-Type', $contentType);
    }
514591
private function parseConfigs(EventParam $e)
    {
        foreach(ServerManage::getServers() as $name => $server)
        {
            if(!$server instanceof \Imi\Server\UdpServer\Server)
            {
                continue;
            }
            $route = $server->getBean('UdpRoute');
            foreach(Helper::getMain($server->getConfig()['namespace'])->getConfig()['route'] ?? [] as $url => $routeOption)
            {
                $routeAnnotation = new UdpRoute($routeOption['route'] ?? []);
                if(isset($routeOption['callback']))
                {
                    $callable = $routeOption['callback'];
                }
                else
                {
                    $callable = new RouteCallable($routeOption['controller'], $routeOption['method']);
                }
                $route->addRuleAnnotation($routeAnnotation, $callable, [
                    'middlewares' => $routeOption['middlewares'],
                ]);
            }
        }
    }