@param Request $request

@return NegotiatedValueInterface|null
196915
public function negotiate(Request $request)
    {
        if ([] === $this->supportedLocales) {
            return null;
        }

        if (!$request->hasHeader('Accept-Language')) {
            return null;
        }

        $aggregatedValues = $this->aggregatedValues($request->getHeaderLine('Accept-Language'));

        return $this->compareAgainstSupportedLocales($aggregatedValues);
    }
201716
public function cgetAction(Request $request)
    {
        if ('true' == $request->get('flat')) {
            /** @var RestHelperInterface $restHelper */
            $restHelper = $this->get('sulu_core.doctrine_rest_helper');

            /** @var DoctrineListBuilderFactory $factory */
            $factory = $this->get('sulu_core.doctrine_list_builder_factory');

            $listBuilder = $factory->create($this->container->getParameter('sulu.model.role.class'));

            $restHelper->initializeListBuilder($listBuilder, $this->getFieldDescriptors());

            $list = new ListRepresentation(
                $listBuilder->execute(),
                static::$entityKey,
                'get_roles',
                $request->query->all(),
                $listBuilder->getCurrentPage(),
                $listBuilder->getLimit(),
                $listBuilder->count()
            );
        } else {
            $roles = $this->getRoleRepository()->findAllRoles();
            $convertedRoles = [];
            if (null != $roles) {
                foreach ($roles as $role) {
                    array_push($convertedRoles, $this->convertRole($role));
                }
            }
            $list = new CollectionRepresentation($convertedRoles, static::$entityKey);
        }
        $view = $this->view($list, 200);

        return $this->handleView($view);
    }
1094707
public function read(Request $request)
    {
        if (!$request->cookies->has($this->cookieSettings->getName())) {
            return null;
        }

        return $this->createCookieWithValue(
            $request->cookies->get($this->cookieSettings->getName())
        );
    }
490790
private function getUserAgent(Request $request)
    {
        if (!$this->userAgent) {
            $this->userAgent = $request->headers->get('User-Agent');
        }

        return $this->userAgent;
    }
201558
public function setRequest(Request $request)
    {
        $context = (new RequestContext())->fromRequest($request);

        $this->cachedRoot = null;
        $this->cachedSchema = null;
        return $this->setContext($context);
    }
1367872
protected function resolveAuthorizer(Request $request)
    {
        if (! isset($this->authorizers[$request->getHandler()])) {
            return null;
        }

        try {
            $authorizerClass = $this->authorizers[$request->getHandler()];
            return $this->container->make($authorizerClass);
        } catch (BindingResolutionException $e) {
            return null;
        }
    }
1012060
protected function getRequestOrigin(HTTPRequest $request)
    {
        // Prefer Origin header
        $origin = $request->getHeader('Origin');
        if ($origin) {
            return $origin;
        }

        // Check referer
        $referer = $request->getHeader('Referer');
        if ($referer) {
            // Extract protocol, hostname, and port
            $refererParts = parse_url($referer);
            if (!$refererParts) {
                return null;
            }
            // Rebuild
            $origin = $refererParts['scheme'] . '://' . $refererParts['host'];
            if (isset($refererParts['port'])) {
                $origin .= ':' . $refererParts['port'];
            }
            return $origin;
        }

        return null;
    }
641650
public function getAcceptHandler(Request $request)
    {
        $accept     = $request->getHeaderLine('Accept');
        $priorities = $this->priorities();

        if (! empty($accept)) {
            $preferred = $this->negotiator->getBest($accept, array_keys($priorities));
        }

        if (! empty($preferred)) {
            $handler = $priorities[$preferred->getValue()];
        } else {
            return null;
        }

        unset($preferred, $accept, $priorities);

        return $handler;
    }
630179
private function getVaryKey(RequestInterface $request)
    {
        $key = $this->keyPrefix . md5('vary ' . $this->getCacheKey($request));

        return $key;
    }
894140
public function updateAction(Request $request)
    {
        $schemaAlias = $request->attributes->get('schema');

        $this->isGrantedOr403($schemaAlias);

        $settingsManager = $this->getSettingsManager();
        $settings = $settingsManager->load($schemaAlias);

        $isApiRequest = $this->isApiRequest($request);

        $form = $this
            ->getSettingsFormFactory()
            ->create($schemaAlias, $settings, $isApiRequest ? ['csrf_protection' => false] : [])
        ;

        if ($form->handleRequest($request)->isValid()) {
            $messageType = 'success';
            try {
                $settingsManager->save($settings);
                $message = $this->getTranslator()->trans('sylius.settings.update', [], 'flashes');
            } catch (ValidatorException $exception) {
                $message = $this->getTranslator()->trans($exception->getMessage(), [], 'validators');
                $messageType = 'error';
            }

            if ($isApiRequest) {
                return $this->handleView($this->view(null, Response::HTTP_NO_CONTENT));
            }

            $request->getSession()->getBag('flashes')->add($messageType, $message);

            if ($request->headers->has('referer')) {
                return $this->redirect($request->headers->get('referer'));
            }
        }

        return $this->render($request->attributes->get('template', 'SyliusSettingsBundle:Settings:update.html.twig'), [
            'settings' => $settings,
            'form' => $form->createView(),
        ]);
    }
972534
private function _convertGetCompetitivePricingForSKU($request) {

        $parameters = array();
        $parameters['Action'] = 'GetCompetitivePricingForSKU';
        if ($request->isSetSellerId()) {
            $parameters['SellerId'] =  $request->getSellerId();
        }
        if ($request->isSetMWSAuthToken()) {
            $parameters['MWSAuthToken'] =  $request->getMWSAuthToken();
        }
        if ($request->isSetMarketplaceId()) {
            $parameters['MarketplaceId'] =  $request->getMarketplaceId();
        }
        if ($request->isSetSellerSKUList()) {
            $SellerSKUListGetCompetitivePricingForSKURequest = $request->getSellerSKUList();
            foreach  ($SellerSKUListGetCompetitivePricingForSKURequest->getSellerSKU() as $SellerSKUSellerSKUListIndex => $SellerSKUSellerSKUList) {
                $parameters['SellerSKUList' . '.' . 'SellerSKU' . '.'  . ($SellerSKUSellerSKUListIndex + 1)] =  $SellerSKUSellerSKUList;
            }
        }

        return $parameters;
    }
224908
private function getUser(Request $request)
    {
        if ($this->configurationHandler->getParameter('terms_of_service')
            && 'claroline_locale_change' !== $request->get('_route')
            && 'claroline_locale_select' !== $request->get('_route')
            && 'bazinga_exposetranslation_js' !== $request->get('_route')
            && ($token = $this->tokenStorage->getToken())
            && ($user = $token->getUser())
            && $user instanceof User
        ) {
            return $user;
        }

        return null;
    }
1316945
private function query(RequestInterface $request)
    {
        return $this->client->send($request, array_merge(
            [RequestOptions::HTTP_ERRORS => false],
            $this->clientOptions
        ));
    }
257357
public function toResponse($request)
    {
        $transformer = app()->make(
            'InetStudio\PollsPackage\Analytics\Contracts\Transformers\Back\Result\PollTransformerContract'
        );
        $serializer = app()->make('InetStudio\AdminPanel\Base\Contracts\Serializers\SimpleDataArraySerializerContract');

        $resource = new Item($this->item, $transformer);

        $manager = new Manager();
        $manager->setSerializer($serializer);

        $item = $manager->createData($resource)->toArray();

        return view('admin.module.polls.analytics::back.modals.result', compact('item'))->render();
    }
497632
protected function getVariables(Request $request)
    {
        $token  = $this->securityContext->getToken();
        $user   = null;
        $roles  = [];

        if ($token instanceof TokenInterface) {
            $user = $token->getUser();

            if (null !== $this->roleHierarchy) {
                $roles = $this->roleHierarchy->getReachableRoles($token->getRoles());
            } else {
                $roles = $token->getRoles();
            }
        }

        $variables = array(
            'token' => $token,
            'user'  => $user,
            // we removed "object" and "request"
            'roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $roles),
            'trust_resolver' => $this->trustResolver,
            'security_context' => $this->securityContext,
        );

        // controller variables should also be accessible: repository, entity...
        return array_merge($request->attributes->all(), $variables);
    }
263027
public function updateValueAction(Request $request)
    {
        $name = $request->get('name');
        $value = $request->get('value');

        $manager = $this->get('ongr_settings.settings_manager');
        $manager->update($name, ['value' => $value]);

        return new JsonResponse(['error' => false]);
    }
1151055
protected function configureRequest(RequestInterface $Request)
    {
        if ($Request->getStatus() >= Curl::STATUS_SENT){
            $Request->reset();
        }
        if (isset($this->properties[self::PROPERTY_HTTP_METHOD]) &&
            $this->properties[self::PROPERTY_HTTP_METHOD] !== ''){
            $Request->setMethod($this->properties[self::PROPERTY_HTTP_METHOD]);
        }
        $url = $this->configureURL($this->getOptions());
        if ($this->verifyUrl($url)) {
            $url = rtrim($this->getBaseUrl(),"/")."/".$url;
            $Request->setURL($url);
        }
        $data = ($this->getData()?$this->getData():NULL);
        $data = $this->configureData($data);
        $Request->setBody($data);
        if ($this->authRequired()){
            if (isset($this->Auth)){
                $this->Auth->configureRequest($Request);
            }
        }
        return $Request;
    }