@param Request $request

@throws \InvalidArgumentException

@return DataInterface|null
179189
protected function getData(Request $request)
    {
        $data = null;
        if ($request->query->has('dataId')) {
            $data = $this->get(DataRepository::class)->find($request->query->get('dataId'));
        }

        return $data;
    }
719413
private function createAdapterStrategyFor(Request $request)
    {
        $requestClass  = get_class($request);
        $strategyClass = isset($this->strategyMap[$requestClass])
            ? $this->strategyMap[$requestClass]
            : null;

        if ($strategyClass !== null) {
            return new $strategyClass($this->client);
        }

        throw new InvalidArgumentException(sprintf("Unknown message : %s", get_class($request)));
    }
178957
public function resolve($request = null)
    {
        $data = $this->toArray(
            $request = $request ?: Container::getInstance()->make('request')
        );

        if ($data instanceof Arrayable) {
            $data = $data->toArray();
        } elseif ($data instanceof JsonSerializable) {
            $data = $data->jsonSerialize();
        }

        return $this->filter((array) $data);
    }
821840
public function entryAction(Request $request)
    {
		if(!$request->request->has('eventkey')) {
			throw new InvalidArgumentException("Missing eventKey parameter");
		}

		if(!$request->request->has('eventvalue')) {
			throw new InvalidArgumentException("Missing eventValue parameter");
		}

		$eventkey 	= $request->get('eventKey');
		$eventvalue = $request->get('eventValue');

		$this->get('event_dispatcher')->dispatch(DispatcherEventName::API_DISPATCHER_ENTRY, new DispatcherEntryEvent($eventkey, $eventvalue));

		return new JsonResponse();
    }
72717
public function dispatch(Request $request)
    {
        /** @var DispatcherInterface $dispatcher */
        $dispatcher = $this->make(DispatcherInterface::class);

        return $dispatcher->dispatch($request);
    }
224626
private function runBackendTreeToggle(Request $request)
    {
        if (null === ($request->query->get('picker'))) {
            throw new \InvalidArgumentException('No picker was given here.');
        }
        $picker = $this->container->get('contao.picker.builder')->createFromData($request->query->get('picker'));

        $treeSelector = $this->prepareTreeSelector($picker);

        $sessionBag = $this->container->get('session')->getBag('contao_backend');
        $sessionBag->set($treeSelector->getSearchSessionKey(), $picker->getConfig()->getValue());

        $buffer = $treeSelector->generateAjax();

        $response = new Response($buffer);
        $response->headers->set('Content-Type', 'txt/html; charset=' . Config::get('characterSet'));

        return $response;
    }
35590
protected function setDataFromRequest(RequestInterface $request)
    {
        $keys = $this->validDataFromRequest();
        $data = $request->getParams($keys);

        if (isset($data['obj_type'])) {
            $this->objType = $data['obj_type'];
        }

        if (isset($data['obj_id'])) {
            $this->objId = $data['obj_id'];
        }

        if (isset($data['property'])) {
            $this->propertyIdent = $data['property'];
        }

        return $this;
    }
461109
public function execute(RequestInterface $request): RequestInterface
    {
        if ($request->getUri()->getPath() === self::ENDPOINT_INSTALLATION) {
            return $request;
        } else {
            $signature = $this->determineRequestSignature(
                $request->getUri(),
                $request->getMethod(),
                $request->getBody()->getContents(),
                $request->getHeaders()
            );

            return $request->withHeader(self::HEADER_CLIENT_SIGNATURE, $signature);
        }
    }
599875
public static function fromRequest(RequestInterface $request)
    {
        if ($request->hasHeader('X-Endpoint')) {
            $name = $request->getHeaderLine('X-Endpoint');
            
            if (! isset(BaseApi::$endpointDefinitions[$name])) {
                throw new \InvalidArgumentException('Could not resolve Endpoint from the request: \n'.$request->getRequestTarget());
            }
            
            /** @var BaseEndpoint $endpointClass */
            $endpointClass = BaseApi::$endpointDefinitions[$name]['class'];

            return new $endpointClass(Region::create($request->getHeaderLine('X-Region')));
        }
        
        $matchingScore = -1;
        /** @var Endpoint $endpointInstance */
        $endpointInstance = null;

        foreach (BaseApi::$endpointDefinitions as $urlTemplate => $definition) {
            $score = levenshtein($request->getRequestTarget(), $urlTemplate);
            if ($score > $matchingScore) {
                $matchingScore = $score;
                $endpointInstance = $definition['instance'];
            }
        }
        
        return $endpointInstance;
    }
1193012
protected function getAuth(Request $request) : Auth
    {
        $auth = $request->getAttribute($this->authAttribute);
        if (! $auth instanceof Auth) {
            throw new \InvalidArgumentException(
                'Auth attribute not available in request'
            );
        }
        return $auth;
    }
1110407
public function parse($request)
    {
        $object = clone $this->requestObject;
        foreach ($this->propertyParsers as $propertyParser) {
            try {
                $this->setProperty($request, $object, $propertyParser);
            } catch (InvalidValueException $e) {
                $propertyName = $propertyParser->getName();
                $exception = new InvalidRequestException($propertyName . ': ' . $e->getMessage());
                $exception->setErrors([$propertyName => $e->getMessage()]);
                throw $exception;
            }
        }

        return clone $object;
    }
1309157
public function parseQueryFromRequest(RequestInterface $request = null)
    {
        if ($request === null && $this->currentRequest === null) {
            throw new \InvalidArgumentException('No request is provided.');
        }

        $req = $request === null
            ? $this->currentRequest
            : $request;

        /* Rempli un array des paramètres de l'Uri. */
        parse_str($req->getUri()->getQuery(), $parseQuery);

        /*
         * Pour avoir le paramètre non identifié par une clé.
         * Exemple : http://exemple.com/?first_param = 'first_param'
         * Il faut prendre le 1er élément du tableau inversé des paraètres de l'Uri.
         */
        return !empty($parseQuery)
            ? rawurlencode(array_keys($parseQuery)[ 0 ])
            : '%2F';
    }
364042
public function onRequest( RequestInterface $request ) {
        $localizedUri = Uri::withQueryValue( $request->getUri(), 'lang', $this->getEndpoint()->getLang() );
        return $request->withUri($localizedUri);
    }
371685
public function onRequest( RequestInterface $request ) {
        $schema = $this->getEndpoint()->getSchema();

        return $request->withHeader( 'X-Schema-Version', $schema );
    }
1357436
protected function getRouteFromRequest(Request $request)
    {
        $attributes = $request->attributes->get('_route_params');

        if (isset($attributes[RouteObjectInterface::ROUTE_OBJECT])
            && ($attributes[RouteObjectInterface::ROUTE_OBJECT] instanceof RouteInterface)
        ) {
            return $attributes[RouteObjectInterface::ROUTE_OBJECT];
        }

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

        $this->cachedRoot = null;
        $this->cachedSchema = null;
        return $this->setContext($context);
    }
415231
public function createAction(Request $request)
    {
        $entity = new MessageType();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);
        $data = $form->getData();
        if (!$data->getParent() && !isset($request->request->get($form->getName())['create_group'])) {
            throw new \InvalidArgumentException('You must either check "This is a new group" to verify that you want a new group or choose a group in the drop down.');
        }

        if ($form->isValid()) {
            $em = $this->getDoctrineManager();
            $em->persist($entity);
            $em->flush();
            return $this->redirectToRoute('messagetype_show', array('id' => $entity->getId()));
        }

        return $this->render(
            'BisonLabSakonninBundle:MessageType:edit.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }