@param QueryHandlerConfigurationInterface $queryHandlerConfiguration
@param string                             $code
@param array                              $configuration

@throws \UnexpectedValueException

@return FilterInterface
964591
public function createFilter(
        QueryHandlerConfigurationInterface $queryHandlerConfiguration,
        string $code,
        array $configuration
    ): FilterInterface {
        return new Filter(
            $queryHandlerConfiguration,
            $code,
            $configuration['type'],
            $configuration['attributes'],
            $configuration['form_type'],
            $configuration['label'],
            $configuration['options'],
            $configuration['form_options'],
            $configuration['default']
        );
    }
395677
private static void enableHandler(final LogContextConfiguration configuration, final String handlerName) {
        final HandlerConfiguration handlerConfiguration = configuration.getHandlerConfiguration(handlerName);
        try {
            handlerConfiguration.setPropertyValueString("enabled", "true");
            return;
        } catch (IllegalArgumentException e) {
            // do nothing
        }
        final Map<String, String> disableHandlers = configuration.getLogContext().getAttachment(CommonAttributes.ROOT_LOGGER_NAME, DISABLED_HANDLERS_KEY);
        if (disableHandlers != null && disableHandlers.containsKey(handlerName)) {
            synchronized (HANDLER_LOCK) {
                final String filter = disableHandlers.get(handlerName);
                handlerConfiguration.setFilter(filter);
                disableHandlers.remove(handlerName);
            }
        }
    }
891022
public function getConfigurationEntityFromCode($code)
    {
        $dbConfiguration = IndexEngineIndexQuery::create()->findOneByCode($code);

        if (null === $dbConfiguration) {
            throw new InvalidArgumentException(sprintf("The index configuration code '%s' doesn't exist", $code));
        }

        return $this->getConfigurationEntityFromPropelEntity($dbConfiguration);
    }
356785
public function processFirewallFilters(array &$configuration)
    {
        if (!isset($configuration['TYPO3']['Flow']['security']['firewall']['filters'])) {
            return;
        }
        $filtersConfiguration = &$configuration['TYPO3']['Flow']['security']['firewall']['filters'];
        foreach ($filtersConfiguration as $filterIndex => &$filterOptions) {
            // already converted?
            if (isset($filterOptions['pattern']) || !isset($filterOptions['patternType'])) {
                continue;
            }
            $patternValue = isset($filterOptions['patternValue']) ? $filterOptions['patternValue'] : '';

            switch (strtolower($filterOptions['patternType'])) {
                case 'controllerobjectname':
                    $patternClassName = ControllerObjectName::class;
                    $filterOptions['pattern'] = 'ControllerObjectName';
                    $filterOptions['patternOptions'] = ['controllerObjectNamePattern' => $patternValue];
                    break;
                case 'csrfprotection':
                    $patternClassName = CsrfProtection::class;
                    $filterOptions['pattern'] = 'CsrfProtection';
                    break;
                case 'host':
                    $patternClassName = Host::class;
                    $filterOptions['pattern'] = 'Host';
                    $filterOptions['patternOptions'] = ['hostPattern' => $patternValue];
                    break;
                case 'ip':
                    $patternClassName = Ip::class;
                    $filterOptions['pattern'] = 'Ip';
                    $filterOptions['patternOptions'] = ['cidrPattern' => $patternValue];
                    break;
                case 'uri':
                    $patternClassName = Uri::class;
                    $filterOptions['pattern'] = 'Uri';
                    $filterOptions['patternOptions'] = ['uriPattern' => $patternValue];
                    break;
                default:
                    $this->showWarning(sprintf('Could not automatically convert the syntax of the custom firewall filter "%s". Please adjust it manually as described in the documentation.', $filterOptions['patternType']));
                    $patternClassName = $filterOptions['patternType'];
            }
            if (isset($filterOptions['pattern'])) {
                unset($filterOptions['patternType'], $filterOptions['patternValue']);
            }
            if (is_numeric($filterIndex)) {
                $patternIdentifier = $this->targetPackageData['packageKey'] . ':' . $this->getShortClassName($patternClassName);
                $uniquePatternIdentifier = $patternIdentifier;
                $loopCounter = 1;
                while (isset($filtersConfiguration[$uniquePatternIdentifier])) {
                    $uniquePatternIdentifier = $patternIdentifier . '_' . (++ $loopCounter);
                }
                unset($filtersConfiguration[$filterIndex]);
                $filtersConfiguration[$uniquePatternIdentifier] = $filterOptions;
            }
            $this->showNote(sprintf('Adjusted configuration syntax of the "%s" firewall filter.', $patternClassName));
        }
    }
144843
public static QueryableStateConfiguration fromConfiguration(Configuration config) {
		if (!config.getBoolean(QueryableStateOptions.ENABLE_QUERYABLE_STATE_PROXY_SERVER)) {
			return null;
		}

		final Iterator<Integer> proxyPorts = NetUtils.getPortRangeFromString(
			config.getString(QueryableStateOptions.PROXY_PORT_RANGE));
		final Iterator<Integer> serverPorts = NetUtils.getPortRangeFromString(
			config.getString(QueryableStateOptions.SERVER_PORT_RANGE));

		final int numProxyServerNetworkThreads = config.getInteger(QueryableStateOptions.PROXY_NETWORK_THREADS);
		final int numProxyServerQueryThreads = config.getInteger(QueryableStateOptions.PROXY_ASYNC_QUERY_THREADS);

		final int numStateServerNetworkThreads = config.getInteger(QueryableStateOptions.SERVER_NETWORK_THREADS);
		final int numStateServerQueryThreads = config.getInteger(QueryableStateOptions.SERVER_ASYNC_QUERY_THREADS);

		return new QueryableStateConfiguration(
			proxyPorts,
			serverPorts,
			numProxyServerNetworkThreads,
			numProxyServerQueryThreads,
			numStateServerNetworkThreads,
			numStateServerQueryThreads);
	}
624720
public function incorrectQueryHandler($key, $value, $expr)
    {
        if (!is_string($value)) {
            return null;
        }
        if (strpos($value, '&&') && strpos($value, '||')) {
            throw new QueryParseException('Mixed && and || operators are not supported', 1);
        }
    }
27185
public function hasQueryHandler(string $code): bool
    {
        return array_key_exists($code, $this->queryHandlers)
            || array_key_exists($code, $this->queryHandlerConfigurations)
            || array_key_exists($code, $this->rawQueryHandlerConfigurations);
    }
182053
protected function prepareHandler(HandlerInterface $handler, array $config = [])
    {
        if (! isset($config['formatter'])) {
            $handler->setFormatter($this->formatter());
        } elseif ($config['formatter'] !== 'default') {
            $handler->setFormatter($this->app->make($config['formatter'], $config['formatter_with'] ?? []));
        }

        return $handler;
    }
1064360
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
        if (null === $request) {
            throw new \UnexpectedValueException('$request can not be null');
        }

        $conn->controller = $this->_noopController;

        $uri = $request->getUri();

        $context = $this->_matcher->getContext();
        $context->setMethod($request->getMethod());
        $context->setHost($uri->getHost());

        try {
            $route = $this->_matcher->match($uri->getPath());
        } catch (MethodNotAllowedException $nae) {
            return $this->close($conn, 405, array('Allow' => $nae->getAllowedMethods()));
        } catch (ResourceNotFoundException $nfe) {
            return $this->close($conn, 404);
        }

        if (is_string($route['_controller']) && class_exists($route['_controller'])) {
            $route['_controller'] = new $route['_controller'];
        }

        if (!($route['_controller'] instanceof HttpServerInterface)) {
            throw new \UnexpectedValueException('All routes must implement Ratchet\Http\HttpServerInterface');
        }

        $parameters = [];
        foreach($route as $key => $value) {
            if ((is_string($key)) && ('_' !== substr($key, 0, 1))) {
                $parameters[$key] = $value;
            }
        }
        $parameters = array_merge($parameters, gPsr\parse_query($uri->getQuery() ?: ''));

        $request = $request->withUri($uri->withQuery(gPsr\build_query($parameters)));

        $conn->controller = $route['_controller'];
        $conn->controller->onOpen($conn, $request);
    }
611340
public function execute(Query $query, array $options = [])
    {
        $result = $this->_executeQuery($query, $options);

        if ($this->getDriver() === null) {
            throw new \UnexpectedValueException(__('No driver has been defined'));
        }

        // Write to the logger when one has been defined
        if ($this->getDriver()->getLogger()) {
            $this->_logQuery($query, $this->getDriver()->getLogger());
        }

        return $result;
    }
1339723
public function useFiltersFromTypoScript(): QueryBuilder
    {
        $filters = Filters::fromTypoScriptConfiguration($this->typoScriptConfiguration);
        $this->queryToBuild->setFilterQueries($filters->getValues());

        $this->useFilterArray($this->getAdditionalFilters());

        $searchQueryFilters = $this->typoScriptConfiguration->getSearchQueryFilterConfiguration();

        if (!is_array($searchQueryFilters) || count($searchQueryFilters) <= 0) {
            return $this;
        }

        // special filter to limit search to specific page tree branches
        if (array_key_exists('__pageSections', $searchQueryFilters)) {
            $pageIds = GeneralUtility::trimExplode(',', $searchQueryFilters['__pageSections']);
            $this->usePageSectionsFromPageIds($pageIds);
            $this->typoScriptConfiguration->removeSearchQueryFilterForPageSections();
        }

        return $this;
    }
346325
private function getFilter(ConfigurationInterface $moduleConfiguration)
    {
        $filterId = $moduleConfiguration->getDefaultFilterId();
        if (isset($this->filterCache[$filterId])) {
            return $this->filterCache[$filterId];
        }
        $filterConfiguration = $this->dbAdapter->getFilterDefinitionFromId($moduleConfiguration->getDefaultFilterId());
        $this->filterCache[$filterId] = $this->filterFactory->createFilter($filterConfiguration);

        return $this->filterCache[$filterId];
    }
115627
static public function jiraGetIssueList(array $configuration, array $keyList, array $parameterList = [])
    {
        $issueList = [];

        if (empty($keyList)) {
            return $issueList;
        }

        foreach (array_chunk($keyList, 50) as $chunk) {
            $parameterList['jql'] = 'key IN(' . implode(', ', $chunk) . ')';

            $json = self::jiraGet(
                $configuration['host'] . $configuration['endpoint']['search'],
                $configuration['loginHash'],
                $parameterList
            );

            if (!isset($json->issues)) {
                throw new ContextRuntimeException(
                    'No issues found',
                    StatusCode::INTERNAL_SERVER_ERROR,
                    ['response' => $json]
                );
            }

            foreach ($json->issues as $issue) {
                $issueList[] = $issue;
            }
        }

        return $issueList;
    }
469455
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $config = $this->container->get('config');

        $locale = $config->get('app.i18n.locale');

        if (\is_array($locale)) {
            $found = null;
            foreach ($locale as $k => $v) {
                switch ($k) {
                    case 'query':
                        $found = $request->getQueryParams()[$v] ?? null;
                        break;
                    case 'cookie':
                        $found = $request->getCookieParams()[$v] ?? null;
                        break;
                    case 'default':
                        $found = $v;
                        break;
                }

                if ($found) {
                    break;
                }
            }

            $locale = $found;
        }

        if ($locale) {
            $locale = \str_replace('-', '_', $locale);

            $alias = $config->get('app.i18n.alias');
            if (!empty($alias)) {
                $locale = $alias[\explode('_', $locale, 2)[0]] ?? $locale;
            }

            $this->container->get('i18n')->translator(
                $locale,
                $config->get('app.i18n.domain'),
                \base_path('lang')
            );
        }

        return $handler->handle($request);
    }
297748
public function handle(QueryInterface $query)
    {
        $data = $this->configurationFileReader->getData();

        return $this->getConfigurationDataResponse($data);
    }
1070638
public function handle(string $content, array $configuration): string
    {
        $request = $this->requestStack->getCurrentRequest();

        $request->attributes->set('data', $this->cObj->data);
        $request->attributes->set('_controller', $configuration['controller']);

        $request->headers->set('X-Php-Ob-Level', \ob_get_level());

        // request
        $event = new GetResponseEvent($this->kernel, $request, HttpKernel::SUB_REQUEST);
        $this->dispatcher->dispatch(KernelEvents::REQUEST, $event);

        if ($event->hasResponse()) {
            return $this->filterResponse($event->getResponse(), $request, HttpKernel::SUB_REQUEST);
        }

        // load controller
        $controller = $this->resolver->getController($request);
        if (false === $controller) {
            throw new NotFoundHttpException(\sprintf('Unable to find the controller "%s". The content element is wrongly configured.', $request->attributes->get('_controller', $configuration['controller'])));
        }

        $event = new FilterControllerEvent($this->kernel, $controller, $request, HttpKernel::SUB_REQUEST);
        $this->dispatcher->dispatch(KernelEvents::CONTROLLER, $event);
        $controller = $event->getController();

        // controller arguments
        $arguments = $this->argumentResolver->getArguments($request, $controller);

        $event = new FilterControllerArgumentsEvent($this->kernel, $controller, $arguments, $request, HttpKernel::SUB_REQUEST);
        $this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS, $event);
        $controller = $event->getController();
        $arguments = $event->getArguments();

        // call controller
        try {
            $response = $controller(...$arguments);
        } catch (NotFoundHttpException $e) {
            $psrResponse = $this->errorController->pageNotFoundAction(
                $this->psrHttpFactory->createRequest($request),
                $e->getMessage()
            );

            throw new ImmediateResponseException($psrResponse);
        }

        // view
        if (!$response instanceof Response) {
            $event = new GetResponseForControllerResultEvent($this->kernel, $request, HttpKernel::SUB_REQUEST, $response);
            $this->dispatcher->dispatch(KernelEvents::VIEW, $event);

            if ($event->hasResponse()) {
                $response = $event->getResponse();
            } else {
                $msg = \sprintf('The controller must return a "Symfony\Component\HttpFoundation\Response" object but it returned %s.', $this->varToString($response));

                // the user may have forgotten to return something
                if (null === $response) {
                    $msg .= ' Did you forget to add a return statement somewhere in your controller?';
                }

                throw new ControllerDoesNotReturnResponseException($msg, $controller, __FILE__, __LINE__ - 23);
            }
        }

        return $this->filterResponse($response, $request, HttpKernel::SUB_REQUEST);
    }
1003095
public function getFilterExpressions(array $filterConfigurations, Query $baseQuery): array
    {
        $filterExpressions = [];
        foreach ($filterConfigurations as $filterConfiguration) {
            $filterObject = $this->constructFilterObject($filterConfiguration);
            if ($filterObject instanceof DoctrineFilterInterface) {
                foreach ($filterObject->getFilterExpressions($baseQuery) as $filterExpression) {
                    $filterExpressions[] = $filterExpression;
                }
            }
        }
        return $filterExpressions;
    }