Transforms a request

@param  Request $requestIn  The original request object
@param  Request $requestOut The request object to transform
@return Request The transformed request
9529
public function transformRequest(Request $requestIn, Request $requestOut)
    {
        $requestOut = Request::create(
            $requestOut->getUri(),
            $requestOut->getMethod(),
            [],
            [],
            [],
            [],
            json_encode(
                $this->transformer->transform(json_decode($requestIn->getContent()), $this->mapping)
            )
        );
        return $requestOut;
    }
978412
public function send(RequestInterface $request)
    {
        if (!RequestMethods::isAllowed($request->getMethod())) {
            throw new RequestException('request method is not allowed');
        }

        $transportRequest = $this->transport->createRequest($request->getMethod());
        $transportRequest->setPath($this->generatePath($request));
        $transportRequest = $this->setBody($transportRequest, $request->getBody());
        $transportRequest = $this->setQueryParameters($transportRequest, $request->getParameters());

        try {
            $transportResponse = $this->transport->send($transportRequest);
        } catch (TransportLayerException $exception) {
            $clientException = new ClientException($exception->getMessage(), $exception->getCode(), $exception);
            throw $clientException;
        }

        $rawData = (string)$transportResponse->getBody();

        /** @var Response $response */
        $response = $request->createResponse($rawData, $request->getSerializer(), $request->getSerializerParams());
        $supportedClass = $request->getSupportedClass();

        $this->mangleSupportedClass($response, $supportedClass);

        return $response;
    }
1171870
private function transformResponseToResult(
        ResponseInterface $response,
        RequestInterface $request,
        CommandInterface $command
    ) {
        $transform = $this->responseToResultTransformer;

        return $transform($response, $request, $command);
    }
819341
public function modifyResponse(Request $request, Response $response)
    {
        $app = $this->app;

        if (is_admin_panel() || $app->runningInConsole() || $this->isDebugbarRequest() || $request->ajax()) {
            return $response;
        }

        $this->injectAdminBar($response);

        return $response;
    }
581394
public static function transform($object, $request = null)
	{
		return Transformations::transform($object, $request ?: Request::instance());
	}
459262
public function createRequest($requestId, $url, UserEvent $event, EventQueue $queue)
    {
        $start = microtime(true);
        return new Request([
            'url' => $url,
            'responseCallback' => function ($headers, $code) use ($requestId, $start) {
                $end = microtime(true);
                $this->logDebug('[' . $requestId . ']Reponse (after ' . ($end - $start) . 's): ' . $code);
            },
            'resolveCallback' =>
                function ($data, $headers, $code) use ($requestId, $url, $event, $queue, $start) {
                    $end = microtime(true);
                    $message = '[';
                    $message .= $requestId;
                    $message .= ']Download complete (after ';
                    $message .= ($end - $start);
                    $message .= 's): ';
                    $message .= strlen($data);
                    $message .= ' in length length';
                    $this->logDebug($message);
                    $this->emitShorteningEvents($requestId, $url)->then(
                        function ($shortUrl) use ($url, $data, $headers, $code, $end, $start, $event, $queue) {
                            $this->sendMessage(
                                new Url($url, $data, $headers, $code, $end - $start, $shortUrl),
                                $event,
                                $queue
                            );
                        },
                        function () use ($url, $data, $headers, $code, $end, $start, $event, $queue) {
                            $this->sendMessage(new Url($url, $data, $headers, $code, $end - $start), $event, $queue);
                        }
                    );
                }
            ,
        ]);
    }
419782
public function fromIncomingRequest(Request $request)
    {
        return new Span(
            $this->getOrGenerateIdentifier($request, 'X-B3-SpanId'),
            $this->getName($request),
            $this->getOrGenerateIdentifier($request, 'X-B3-TraceId'),
            [
                new Annotation(Annotation::SERVER_RECEIVE, $this->clock->microseconds(), $this->endpointResolver->resolve()),
            ],
            [
                new BinaryAnnotation('http.host', $request->getHost(), BinaryAnnotation::TYPE_STRING),
                new BinaryAnnotation('http.scheme', $request->getScheme(), BinaryAnnotation::TYPE_STRING),
                new BinaryAnnotation('http.path', $request->getPathInfo(), BinaryAnnotation::TYPE_STRING),
            ],
            $this->getIdentifier($request, 'X-B3-ParentSpanId'),
            $request->headers->get('X-B3-Flags') == '1',
            $this->clock->microseconds()
        );
    }
370677
public function requestToCurl(RequestObject $requestObject)
    {
        return sprintf(
            'curl %s %s %s',
            $this->headersToCurl($requestObject->getHeaders()),
            $this->postParametersToCurl($requestObject->getPostParameters()),
            $requestObject->getUri()
        );
    }
118315
public function requestAction(Request $request)
    {
        $form = $this
            ->createForm(new UserForgotPassType())
            ->handleRequest($request)
        ;

        $obj = $form->getData();

        $user = $this->getDoctrine()->getRepository('FOMUserBundle:User')->findOneByUsername($obj['search']);
        if ($user === null) {
            $user = $this->getDoctrine()->getRepository('FOMUserBundle:User')->findOneByEmail($obj['search']);
        }

        if (!$user) {
            $form->addError(new FormError($this->get("templating")->render(
                'FOMUserBundle:Password:request-error-nosuchuser.html.twig',
                array("search" => $obj))));
            return array('form' => $form->createView());
        } elseif ($user->getRegistrationToken()) {
            $form->addError(new FormError($this->get("templating")->render(
                'FOMUserBundle:Password:request-error-userinactive.html.twig', array("user" => $user))));
            return array(
                'user' => $user,
                'form' => $form->createView());
        }

        $this->setResetToken($user);

        return $this->redirect($this->generateUrl('fom_user_password_send'));
    }
678051
public function getNewSession($requestToken)
    {
        try {
            return $this->get('authentication/session/new', ['request_token' => (string) $requestToken]);

            //@codeCoverageIgnoreStart
        } catch (\Exception $e) {
            if ($e->getCode() == 401) {
                throw new UnauthorizedRequestTokenException("The request token has not been validated yet.");
            }
            //@codeCoverageIgnoreEnd
        }
    }
493161
protected function createHttpRequest(RequestEntity $requestEntity) {
		$requestEntity->validate();
		$httpClient = new Client();
		$httpClient->baseUrl = $this->getBaseUrl();
		$request = $httpClient->createRequest();
		$request
			->setOptions($requestEntity->options)
			->setMethod($requestEntity->method)
			->setUrl($requestEntity->uri)
			->setData($requestEntity->data)
			->setHeaders($requestEntity->headers)
			->addHeaders(['user-agent' => 'Awesome-Octocat-App']);
		return $request;
	}
1357091
public function changeSubscriptionArticle(ChangeArticle\RequestData $requestData)
    {
        $request = new ChangeArticle\Request($requestData);

        return $this->sendRequest($request, ChangeArticle\ApiResponse::class);
    }
757728
public function newAction(Request $request)
    {
        $handler = $this->get('lexik_translation.form.handler.trans_unit');

        $form = $this->createForm(TransUnitType::class, $handler->createFormData(), $handler->getFormOptions());

        if ($handler->process($form, $request)) {
            $message = $this->get('translator')->trans('translations.successfully_added', array(), 'LexikTranslationBundle');

            $this->get('session')->getFlashBag()->add('success', $message);

            $redirectUrl = $form->get('save_add')->isClicked() ? 'lexik_translation_new' : 'lexik_translation_grid';

            return $this->redirect($this->generateUrl($redirectUrl));
        }

        return $this->render('@LexikTranslation/Translation/new.html.twig', array(
            'layout' => $this->container->getParameter('lexik_translation.base_layout'),
            'form'   => $form->createView(),
        ));
    }
515075
private function transform(ServerRequestInterface $request, ResponseInterface $response, $transform)
    {
        $image = Image::fromString((string) $response->getBody());
        $hints = $this->getClientHints($request);

        if ($hints) {
            $image->setClientHints($hints);
            $response = $response->withHeader('Vary', implode(', ', $hints));
        }

        $image->transform($transform);

        $body = self::createStream($response->getBody());
        $body->write($image->getString());

        return $response
            ->withBody($body)
            ->withHeader('Content-Type', $image->getMimeType());
    }
885919
private static function fromJsonString($requestBody)
    {
        $data = json_decode($requestBody, true);
        if (JSON_ERROR_NONE !== json_last_error() || !is_array($data)) {
            throw new \RuntimeException('Invalid POST data.');
        }

        return new Message($data);
    }
24744
private function fillGeneralRequestSettings(RequestContext $requestContext): RequestContext
    {
        $requestContext
            ->setContentType(RequestContext::CONTENT_TYPE_FORM_URLENCODED)
            ->setResponseContextClass(JsonResponseContext::class);

        return $requestContext;
    }
189538
protected function sendRequest(array $requestData): TransferInterface
    {
        $response = $this->adapter->sendRequest($requestData);

        return $this->converter->toTransactionResponseTransfer($response);
    }