Processes the form.

@param Request $request
@param mixed $resource
@param string $method

@return Resource
960534
protected function processAction(Request $request, $action = "POST", $resource = array())
    {
        $form = $this->processForm($request, $action, $resource);

        if ($form->isValid()) {
            $resource = $form->getData();

            $this->getResourceManager()->persist($resource);

            $view = $this->view($resource, \FOS\RestBundle\Util\Codes::HTTP_OK);

            return $this->handleView($view);
        }

        $view = $this->view($form, \FOS\RestBundle\Util\Codes::HTTP_BAD_REQUEST);

        return $this->handleView($view);
    }
736124
public function postAction(Request $request)
    {
        $type = 'page';
        $language = $this->getLanguage($request);
        $action = $request->get('action');

        $this->checkActionParameterSecurity($action, $language);

        $document = $this->getDocumentManager()->create($type);
        $formType = $this->getMetadataFactory()->getMetadataForAlias($type)->getFormType();

        $this->persistDocument($request, $formType, $document, $language);
        $this->handleActionParameter($action, $document, $language);
        $this->getDocumentManager()->flush();

        $context = new Context();
        $context->setGroups(['defaultPage']);

        return $this->handleView($this->view($document)->setContext($context));
    }
1163037
protected function createRequest($method)
    {
        $request = new Request();
        $uri = new Uri($this->getResourceUri());
        $uri = $uri->withUserInfo($this->apiKey);

        $request = $request->withMethod($method)
            ->withUri($uri);

        if (in_array($method, array(ClientInterface::METHOD_POST, ClientInterface::METHOD_PUT))) {
            $request = $request->withBody($this->createStringFromArray($this->params));
        }

        return $request;
    }
7627
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
    {
        $uriPath = $request->getUri()->getPath();

        /** @var Description $description */
        foreach ($this->repository as $description) {

            $basePath = $description->getBasePath() ? "{$description->getBasePath()}/" : "";

            foreach ($description->getPaths() as $path) {
                $pathPattern = "$basePath{$path->getPath()}";

                $parameterNames = [];
                foreach ($path->getOperations() as $operation) {
                    foreach ($operation->getParameters() as $parameter) {
                        if ($parameter->getIn() === Parameter::IN_PATH
                            && ($schema = $parameter->getSchema()) instanceof ScalarSchema
                        ) {
                            $parameterName    = $parameter->getName();
                            $parameterNames[] = $parameterName;
                            $typePattern      = $this->typePatternResolver->resolve($schema);
                            $parameterPattern = "(?P<$parameterName>$typePattern)(?=(/|$))";
                            $pathPattern      = str_replace('{' . $parameterName . '}', $parameterPattern, $pathPattern);
                        }
                    }

                    if (preg_match("#^$pathPattern$#", $uriPath, $matches) > 0) {
                        if (strtolower($request->getMethod()) !== $operation->getMethod()) {
                            return Factory::createResponse(405);
                        }

                        $request = Meta::requestWith($request, $description, $operation, $path);

                        foreach ($parameterNames as $parameterName) {
                            $request = $request->withAttribute($parameterName, $matches[$parameterName]);
                        }

                        return $delegate->process($request);
                    }
                }

            }
        }

        return Factory::createResponse(404);
    }
160616
public function process(Request $request, Handler $handler): Response
    {
        try {
            $symfonyRequest = (new HttpFoundationFactory())
                ->createRequest($request);
            $this->router->getContext()->fromRequest($symfonyRequest);
            $route = $this->router
                ->matchRequest($symfonyRequest);
        } catch (MethodNotAllowedException $e) {
            $allows = implode(', ', $e->getAllowedMethods());
            return $this->createResponse(405, $e->getMessage())
                    ->withHeader('Allow', $allows);
        } catch (NoConfigurationException $e) {
            return $this->createResponse(500, $e->getMessage());
        } catch (ResourceNotFoundException $e) {
            return $this->createResponse(404, $e->getMessage());
        }

        foreach ($route as $key => $value) {
            $request = $request->withAttribute($key, $value);
        }

        return $handler->handle($request);
    }
1111589
public function run (Request $request)
    {
        try {

            // Define which method we need to handle
            $this->method = $request->getMethod();

            // Set request
            $this->request = $request;

            // Handle all routes
            $numHandled = 0;
            if (isset($this->routes[$this->method]))
                $numHandled = $this->handle($this->routes[$this->method], true);

            // If no route was handled, trigger the 404 (if any)
            if ($numHandled == 0) {
                if ($this->notFound) {
                    //call_user_func($this->notFound);
                    $this->handleMatch($this->notFound, array());
                } else {

                    $request = Response::error('Page not found.', Response::STATUS_NOTFOUND);
                    $request->output();
                }
            }

            // If it originally was a HEAD request, clean up after ourselves by emptying the output buffer
            if ($_SERVER['REQUEST_METHOD'] == 'HEAD') ob_end_clean();

        } catch (ResponseException $e) {
            $e->getResponse()->output();
        }
    }
1142444
protected function processActionFormCreate(Request $request, ActionMapping $mapping) {
        $formClass = $mapping->getFormClassName();
        if (!$formClass)
            return null;

        /** @var ActionForm $form */
        $form = null;

        // if the form has "session" scope try to find an existing form in the session
        if ($mapping->isSessionScope())
            $form = $request->getSession()->getAttribute($formClass);       // implicitely starts a session

        // if none was found create a new instance
        /** @var ActionForm $form */
        if (!$form) $form = new $formClass($request);

        // if a DispatchAction is used read the action key
        $actionClass = $mapping->getActionClassName();
        if (is_subclass_of($actionClass, DispatchAction::class))
            $form->initActionKey($request);

        // populate the form
        $form->populate($request);

        // store the ActionForm in the request
        $request->setAttribute(ACTION_FORM_KEY, $form);

        // if the form has "session" scope also store it in the session
        if ($mapping->isSessionScope())
            $request->getSession()->setAttribute($formClass, $form);

        return $form;
    }
1188753
private function sendRequest($method, Request $request)
    {
        $request->setMethod($method);

        $response = $this->guzzleClient->send(
            RequestFactory::make($request, $this->getBaseUrl() . $this->getVersion()),
            $this->getRequestOptions($request)
        );

        return ResponseFactory::make($response);
    }
1098488
public function methodMatch($methods, $requestMethod, Request $request)
    {
        $match = false;
        if ($requestMethod === null) {
            $requestMethod = ($request->getRequestMethod()) ? $request->getRequestMethod() : 'GET';
        }
        $methods = explode('|', $methods);
        foreach ($methods as $method) {
            if (strcasecmp($requestMethod, $method) === 0) {
                $match = true;
                break;
            } else {
                continue;
            }
        }
        if ($match === true) {
            return true;
        }

        return false;
    }
807739
public function process(Request $request)
    {
        $this->validate($request->all(), $this->rules);

        if ($request->has('q')) {
            $this->searchQuery = $request->get('q');
        }
        if ($request->has('sort')) {
            foreach (explode(',', $request->get('sort')) as $sort) {
                $this->processOrderByParams($sort);
            }
        }
        $this->processPageParams($request);

        foreach ($this->parsers as $parser) {
            $parser->parse($request);
        }

        return $this;
    }
659617
private function createRequest($method, $resource, array $data = [])
    {
        if (!empty($data)) {
            $data['signature'] = $this->apiSignature;
        }

        return $this->requestFactory->createRequest($method, $resource, [], $this->encode($data));
    }
1013528
public function deleteAction(Request $request)
    {
        if ($this->submitForm($this->buildForm(CsrfProtectionType::class), $request)->isValid()) {
            try {
                $this->getDomainManager()->delete($this->find('delete'));
            } catch (DomainException $e) {
                $this->processException($e);
            }
        }

        return $this->processAction('delete');
    }
134750
public function dispatch(Route $route, Request $request, $controller, $method)
	{
		// First we will make an instance of this controller via the IoC container instance
		// so that we can call the methods on it. We will also apply any "after" filters
		// to the route so that they will be run by the routers after this processing.
		$instance = $this->makeController($controller);

		$this->assignAfter($instance, $route, $request, $method);

		$response = $this->before($instance, $route, $request, $method);

		// If no before filters returned a response we'll call the method on the controller
		// to get the response to be returned to the router. We will then return it back
		// out for processing by this router and the after filters can be called then.
		if (is_null($response))
		{
			$response = $this->call($instance, $route, $method);
		}

		return $response;
	}
933915
public function postAction(Request $request)
    {
        $document = $this->documentManager->create(Structure::TYPE_SNIPPET);
        $form = $this->processForm($request, $document);

        return $this->handleView($form->getData());
    }
4055
public function processRequest(Request $request)
    {
        $contentType = $request->header('content-type') ?: '';

        if (mb_stripos($contentType, 'multipart/form-data') !== false) {
            $this->validateParsedBody($request);
            $request = $this->parseUploadedFiles($request);
        }

        return $request;
    }
7744
public function getAction( Request $request, $resource, $site = 'default' )
	{
		$cntl = $this->createAdmin( $request, $site, $resource );

		if( ( $html = $cntl->get() ) == '' ) {
			return $cntl->getView()->response();
		}

		return $this->getHtml( $html );
	}
1133127
protected function processForm($instance)
    {
        $parameters = $this->getRequestParameters();
        $form = $this->getForm($instance)->bind($parameters);
        $report = $form->validate();
        if ($report->containsError()) {
            $this->returnValidationFailure($report);
        } else {
            $resource = $form->save();
            $this->returnSuccess(['uri' => $resource->getUri()]);
        }
    }