Returns the Device for the given \Wurfl\Request_GenericRequest

@param Request\GenericRequest $request

@return \Wurfl\CustomDevice
166376
private function getDeviceForRequest(Request\GenericRequest $request)
    {
        Handlers\Utils::reset();

        $deviceId = $this->deviceIdForRequest($request);

        return $this->getWrappedDevice($deviceId, $request);
    }
850798
public function processRequest(Request $request)
    {
        return reactAdapt(\Amp\call(function () use ($request) {
            /** @var Response $response */
            $response = yield $this->client->request($request);

            if ($response->getStatus() >= 400) {
                throw new ClientException($response->getReason(), $response->getStatus());
            }

            return new TelegramResponse(yield $response->getBody(), $response->getHeaders());
        }));
    }
1232350
public static function createFromBase(SymfonyRequest $request)
    {
        if ($request instanceof static) {
            return $request;
        }

        $content = $request->content;

        $newRequest = (new static)->duplicate(
            $request->query->all(), $request->request->all(), $request->attributes->all(),
            $request->cookies->all(), $request->files->all(), $request->server->all()
        );

        $newRequest->headers->replace($request->headers->all());

        $newRequest->content = $content;

        $newRequest->request = $newRequest->getInputSource();

        return $newRequest;
    }
547651
private static function getRequest($request, array $config = null)
    {
        if (is_string($request)) {
            return new Request(
                $request,
                isset($config['class']) ? $config['class'] : null,
                isset($config['config']) ? $config['config'] : []
            );
        }

        if (!($request instanceof Request)) {
            throw new \InvalidArgumentException("Embed::create only accepts instances of Embed\\Request or strings");
        }

        return $request;
    }
879395
private function getConsumer($request)
    {
        $consumer_key = $request instanceof Request
            ? $request->getParameter("oauth_consumer_key")
            : null;

        if (!$consumer_key) {
            throw new Exception("Invalid consumer key");
        }

        $consumer = $this->data_store->lookupConsumer($consumer_key);
        if (!$consumer) {
            throw new Exception("Invalid consumer");
        }

        return $consumer;
    }
907329
protected static function currentRequest(HTTPRequest $request = null)
    {
        // Ensure we only use a registered HTTPRequest and don't
        // incidentally construct a singleton
        if (!$request && Injector::inst()->has(HTTPRequest::class)) {
            $request = Injector::inst()->get(HTTPRequest::class);
        }
        return $request;
    }
55334
public function getDevice($deviceID, $request=null)
    {
        if ($request !== null) {
            if (!($request instanceof WURFL_Request_GenericRequest)) {
                throw new InvalidArgumentException("Error: Request parameter must be null or instance of WURFL_Request_GenericRequest");
            }

            // Normalization must be performed if request is passed so virtual capabilities can be
            // resolved correctly.  This is normally handled in self::deviceIdForRequest()
            $generic_normalizer = WURFL_UserAgentHandlerChainFactory::createGenericNormalizers();
            $request->userAgentNormalized = $generic_normalizer->normalize($request->userAgent);
        }
        return $this->getWrappedDevice($deviceID, $request);
    }
480335
public function toResponse($request)
    {
        return (
            $this->resource instanceof AbstractPaginator
                ? new PaginatedResourceResponse($this)
                : new ResourceResponse($this)
        )->toResponse($request);
    }
887516
public function dispatch(SymfonyRequest $request)
    {
        $path = rawurldecode($request->getPathInfo());

        if (substr($path, 0, 3) == '../' || substr($path, -3) == '/..' || strpos($path, '/../') ||
            substr($path, 0, 3) == '..\\' || substr($path, -3) == '\\..' || strpos($path, '\\..\\')) {
            throw new \RuntimeException(t('Invalid path traversal. Please make this request with a valid HTTP client.'));
        }

        $response = null;
        if ($this->app->isInstalled()) {
            $response = $this->getEarlyDispatchResponse();
        }
        if ($response === null) {
            $response = $this->handleDispatch($request);
        }

        return $response;
    }
1090026
protected function getConsumer(&$request)
    {
        $consumer_key = @$request->getParameter("oauth_consumer_key");
        if (!$consumer_key) {
            throw new OAuthException("Invalid consumer key");
        }
        
        $consumer = $this->data_store->lookupConsumer($consumer_key);
        if (!$consumer) {
            throw new OAuthException("Invalid consumer");
        }
        
        return $consumer;
    }
884913
public function toResponse($request)
    {
        $transformer = app()->make(
            'InetStudio\PollsPackage\Polls\Contracts\Transformers\Back\Utility\SuggestionTransformerContract',
            [
                 'type' => $this->type,
             ]
        );

        $resource = $transformer->transformCollection($this->items);

        $serializer = app()->make('InetStudio\AdminPanel\Base\Contracts\Serializers\SimpleDataArraySerializerContract');

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

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

        $data = [
            'suggestions' => [],
            'items' => [],
        ];

        if ($this->type == 'autocomplete') {
            $data['suggestions'] = $transformation;
        } else {
            $data['items'] = $transformation;
        }

        return response()->json($data);
    }
1340980
public static function fromAmazonRequest(array $amazonRequest): self
    {
        $device = new self();

        $device->deviceId            = isset($amazonRequest['deviceId']) ? $amazonRequest['deviceId'] : null;
        $device->supportedInterfaces = isset($amazonRequest['supportedInterfaces']) ? (array) $amazonRequest['supportedInterfaces'] : [];
        $device->accessToken         = isset($amazonRequest['accessToken']) ? $amazonRequest['accessToken'] : null;

        return $device;
    }
371537
public function toDevice($device)
    {
        if (is_array($device)) {
            $this->devices = array_merge($device, $this->devices);

            return $this;
        }
        $this->devices[] = $device;

        return $this;
    }
1132794
public function convertFromRequest(SimplifiedRequest $request)
    {
        return Request::create(
            $request->path,
            $request->method,
            array(),
            array(),
            array(),
            $this->mapHeaderKeys($request->headers),
            $request->content
        );
    }
1346743
public function getDevice($deviceId, Request\GenericRequest $request = null)
    {
        if ($request !== null) {
            if (!($request instanceof GenericRequest)) {
                throw new \InvalidArgumentException(
                    'Error: Request parameter must be null or instance of WURFL_Request_GenericRequest'
                );
            }

            // Normalization must be performed if request is passed so virtual capabilities can be
            // resolved correctly.  This is normally handled in self::deviceIdForRequest()
            $generic_normalizer = UserAgentHandlerChainFactory::createGenericNormalizers();
            $request->setUserAgentNormalized($generic_normalizer->normalize($request->getUserAgent()));
        }

        return $this->getWrappedDevice($deviceId, $request);
    }
788439
public static function fromAmazonRequest(array $amazonRequest): self
    {
        $event = new self();

        $event->gadgetId   = $amazonRequest['gadgetId'];
        $event->timestamp  = new \DateTime($amazonRequest['timestamp']);
        $event->action     = $amazonRequest['action'];
        $event->color      = $amazonRequest['color'];
        $event->feature    = $amazonRequest['feature'];

        return $event;
    }
428392
public function getSupportingHandler(Request $request): AbstractRequestHandler
    {
        foreach ($this->requestHandlers as $requestHandler) {
            if ($requestHandler->supportsApplication($request) && $requestHandler->supportsRequest($request)) {
                return $requestHandler;
            }
        }

        throw new MissingRequestHandlerException();
    }