Show all redirects, and add a button to create a new redirect
@param ServerRequestInterface $request
764260
protected function overviewAction(ServerRequestInterface $request)
    {
        $this->getButtons();
        $demand = Demand::createFromRequest($request);
        $redirectRepository = GeneralUtility::makeInstance(RedirectRepository::class, $demand);
        $count = $redirectRepository->countRedirectsByByDemand();

        $this->view->assignMultiple([
            'redirects' => $redirectRepository->findRedirectsByDemand(),
            'hosts' => $redirectRepository->findHostsOfRedirects(),
            'statusCodes' => $redirectRepository->findStatusCodesOfRedirects(),
            'demand' => $demand,
            'defaultUrl' => GeneralUtility::makeInstance(UrlService::class)->getDefaultUrl(),
            'showHitCounter' => GeneralUtility::makeInstance(Features::class)->isFeatureEnabled('redirects.hitCount'),
            'pagination' => $this->preparePagination($demand, $count),
        ]);
    }
961204
private function decorateRequest(ServerRequestInterface $request)
    {
        if ($request instanceof Http\Request) {
            return $request;
        }

        return new Http\Request($this, $request);
    }
547494
protected function _setRedirectUrl(ServerRequest $request)
    {
        $request->getSession()->delete('SocialAuth.redirectUrl');

        $redirectUrl = $request->getQuery(static::QUERY_STRING_REDIRECT);
        if (empty($redirectUrl)
            || substr($redirectUrl, 0, 1) !== '/'
            || substr($redirectUrl, 0, 2) === '//'
        ) {
            return;
        }

        $request->getSession()->write('SocialAuth.redirectUrl', $redirectUrl);
    }
536927
protected function dispatchRouterRoute(
        ServerRequestInterface $request,
        RouterInterface $router
    ) : ServerRequestInterface {
        $routeInfo = $router->dispatch($request);
        if ($routeInfo[0] === Dispatcher::FOUND) {
            $routeArguments = [];
            foreach ($routeInfo[2] as $k => $v) {
                $routeArguments[$k] = urldecode($v);
            }

            $route = $router->getRouteByIdentifier($routeInfo[1]);
            $route->prepare($request, $routeArguments);
            /**
             * Add route to request to allow handler or other access route
             */
            $request = $request->withAttribute('route', $route);
        }

        $routeInfo['request'] = [$request->getMethod(), (string) $request->getUri()];
        return $request->withAttribute('routeInfo', $routeInfo);
    }
23732
public function getOptions(ServerRequestInterface $request): void
    {
        parent::getOptions($request);

        $this->surname = $request->get('surname', 'replace');
    }
1354828
public function store(CreateRedirectRequest $request)
    {
        $this->authorize(RedirectsPolicy::PERMISSION_CREATE);

        $redirect = Redirect::createRedirect(
            $request->getValidatedData()
        );

        $this->transNotification('created', [], $redirect->toArray());

        return redirect()->route('admin::seo.redirects.show', [$redirect]);
    }
133314
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        // Let's recreate a new context object (because request can be modified by the filters)
        $context = new SplashRequestContext($request);
        $context->setUrlParameters($this->splashRoute->getFilledParameters());
        // Let's pass everything to the controller:
        $args = $this->parameterFetcherRegistry->toArguments($context, $this->splashRoute->getParameters());
        $action = $this->splashRoute->getMethodName();
        $controller = $this->controller;

        try {
            $response = SplashUtils::buildControllerResponse(
                function () use ($controller, $action, $args) {
                    return $controller->$action(...$args);
                },
                $this->mode,
                $this->debug
            );
        } catch (SplashException $e) {
            throw new SplashException($e->getMessage(). ' (in '.$this->splashRoute->getControllerInstanceName().'->'.$this->splashRoute->getMethodName().')', $e->getCode(), $e);
        }
        return $response;
    }
410013
public function handle(ServerRequestInterface $request)
    {
        if (services()->has('csrfProtection')) {
            if (hash_equals(input()->server('REQUEST_METHOD'), 'POST')) {
                if ( ! services()->get('csrfProtection')->verify()) {
                    output()->sendError(403, [
                        'message' => language()->getLine('403_INVALID_CSRF'),
                    ]);
                }
            }
        }
    }
791238
private function mustRedirect(ServerRequestInterface $request): bool
    {
        if ($this->redirect === false) {
            return false;
        }

        return !$this->checkHttpsForward || (
            $request->getHeaderLine('X-Forwarded-Proto') !== 'https' &&
            $request->getHeaderLine('X-Forwarded-Port') !== '443'
        );
    }
1221026
public function handle(ServerRequestInterface $request): ResponseInterface{
        $routing        = $this->getRouteCollector()
            ->router($request->getUri()->getHost(), $request->getMethod())
            ->search($request->getUri()->getPath())
        ;
        $handlerBuilder = $kernel->getRequestHandlerBuilder();

        if($routing->found){
            $method = $routing->data["action"]["method"];
            $object = $kernel->getContainer()->getInstance(
                $routing->data["action"]["class"]
            );
            $action = [$object, $method];

            if($object instanceof Bundle\MiddlewareRegisterInterface){
                $object->middlewareRegister($handlerBuilder);
            }
        }else{
            $action = function(){
                throw new \Fratily\Http\Message\Status\NotFound();
            };
        }

        return $handlerBuilder
            ->append(
                new Controller\ActionMiddleware($this->getContainer())
            )
            ->create(
                $kernel->getContainer()->has("kernel.responseFactory")
                    ? $kernel->getContainer()->get("kernel.responseFactory")
                    : new \Fratily\Http\Message\ResponseFactory()
            )
            ->handle(
                $request
                    ->withAttribute("action", $action)
                    ->withAttribute("routing", $routing)
                    ->withAttribute("kernel", $kernel)
                    ->withAttribute(
                        "environment",
                        $kernel->getConfig()->getEnvironment()
                    )
                    ->withAttribute(
                        "debug",
                        $kernel->getConfig()->isDebug()
                    )
            )
        ;
    }
288123
public function update(ServerRequestInterface $request): ResponseInterface
    {
        $modules = $this->module_service->all(true);

        foreach ($modules as $module) {
            $new_status = (bool) ($request->getParsedBody()['status-' . $module->name()] ?? false);
            $old_status = $module->isEnabled();

            if ($new_status !== $old_status) {
                DB::table('module')
                    ->where('module_name', '=', $module->name())
                    ->update(['status' => $new_status ? 'enabled' : 'disabled']);

                if ($new_status) {
                    FlashMessages::addMessage(I18N::translate('The module “%s” has been enabled.', $module->title()), 'success');
                } else {
                    FlashMessages::addMessage(I18N::translate('The module “%s” has been disabled.', $module->title()), 'success');
                }
            }
        }

        return redirect(route('modules'));
    }
874199
public function create(ServerRequestInterface $request) : CallbackInterface
    {
        $callbacks = [
            XmlCallback::class,
            FormCallback::class,
            RedirectCallback::class
        ];

        foreach ($callbacks as $callback) {
            if (call_user_func([$callback, 'initable'], $request)) {
                return new $callback($request);
            }
        }

        throw new \InvalidArgumentException('A callback could not be instantiated');
    }
178066
public function dispatch(ServerRequestInterface $request)
    {
        parse_str($request->getUri()->getQuery(), $args);
        $uri = '/';
        if (isset($args['page'])) {
            $uri .= $args['page'];
        }

        return $this->createDispatcher()->dispatch(
            $request->getMethod(),
            $uri
        );
    }
318357
public function dispatch(ServerRequestInterface $request)
    {
        $this->finalize();

        $dispatcher = new GroupCountBasedDispatcher($this->getData());
        $uri = '/'.ltrim($request->getUri()->getPath(), '/');

        return $dispatcher->dispatch($request->getMethod(), $uri);
    }
1323423
public function updateLists(ServerRequestInterface $request): ResponseInterface
    {
        $modules = $this->module_service->findByInterface(ModuleListInterface::class, true);

        $this->updateStatus($modules, $request);
        $this->updateAccessLevel($modules, ModuleListInterface::class, $request);

        return redirect(route('lists'));
    }
769004
public function indexAction(Request $request)
    {
        /** @var RedirectionRepository $errorRepository */
        $redirectionRepository = $this->getDoctrine()->getManager()->getRepository('VictoireSeoBundle:Redirection');

        // Fetch errors

        /** @var QueryBuilder $redirections */
        $redirections = $redirectionRepository->getUnresolvedQuery()->getQuery()->getResult();

        // Build forms

        $forms = [];

        /** @var Redirection[] $redirection */
        foreach ($redirections as $redirection) {
            $forms[$redirection->getId()] = $this->getRedirectionForm($redirection,
                sprintf('#redirection-%d-item-container', $redirection->getId())
            )->createView();
        }

        $newForm = $this->getRedirectionForm(new Redirection(), '#new-redirection-form-container')->createView();

        // Return datas

        return new Response($this->renderView('@VictoireSeo/Redirection/index.html.twig', [
            'newForm'      => $newForm,
            'redirections' => $redirections,
            'forms'        => $forms,
        ]));
    }
894923
public function create(ServerRequestInterface $request): ResponseInterface
    {
        $email     = $request->getQueryParams()['email'] ?? '';
        $real_name = $request->getQueryParams()['real_name'] ?? '';
        $username  = $request->getQueryParams()['username'] ?? '';
        $title     = I18N::translate('Add a user');

        return $this->viewResponse('admin/users-create', [
            'email'     => $email,
            'real_name' => $real_name,
            'title'     => $title,
            'username'  => $username,
        ]);
    }