Returns the device id for the device that matches the $request
@param WURFL_Request_GenericRequest $request WURFL Request object
@return string WURFL device id
547965
private function deviceIdForRequest($request) {
		$deviceId = $this->_cacheProvider->load($request->id);
		if (empty($deviceId)) {
			$deviceId = $this->_userAgentHandlerChain->match($request);
			// save it in cache
			$this->_cacheProvider->save($request->id, $deviceId);
		} else {
			$request->matchInfo->from_cache = true;
			$request->matchInfo->lookup_time = 0.0;
		}
		return $deviceId;
	}
697086
protected function getThrottleKey(Request $request)
    {
        return mb_strtolower($request->input($this->loginUsername())) .'|' .$request->ip();
    }
166376
private function getDeviceForRequest(Request\GenericRequest $request)
    {
        Handlers\Utils::reset();

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

        return $this->getWrappedDevice($deviceId, $request);
    }
467084
public static function getUserAgentProfile($request)
    {
        if (isset($request["HTTP_X_WAP_PROFILE"])) {
            return $request["HTTP_X_WAP_PROFILE"];
        }
        if (isset($request["HTTP_PROFILE"])) {
            return $request["HTTP_PROFILE"];
        }
        if (isset($request["Opt"])) {
            $opt = $request["Opt"];
            $regex = "/ns=\\d+/";
            $matches = array();
            $namespaceProfile = null;
            if (preg_match($regex, $opt, $matches)) {
                $namespaceProfile = substr($matches[0], 2) . "-Profile";
            }
            if ($namespaceProfile !== null && isset($request[$namespaceProfile])) {
                return $request[$namespaceProfile];
            }
        }

        return null;
    }
82577
public static function getRemoteIp(Request $request, $trust = false): string
    {
        if ($trust === false) {
            return $request->server->get('REMOTE_ADDR');
        }

        $parameters = [
            'HTTP_CLIENT_IP',
            'HTTP_X_REAL_IP',
            'HTTP_X_FORWARDED_FOR',
        ];

        foreach ($parameters as $parameter) {
            if ($request->server->has($parameter)) {
                return $request->server->get($parameter);
            }
        }

        return $request->server->get('REMOTE_ADDR');
    }
1141790
public function parseQuery($request)
    {
        list($endpoint, $params) = explode('?', $request['request']['uri']);

        $request['endpoint'] = $endpoint;
        $request['params'] = $params;
        $request['method'] = $request['request']['method'];
        $request['raw_data'] = $request['request']['raw_data'];

        if (class_exists(VarCloner::class)) {
            $varCloner = new VarCloner();

            parse_str($params, $stub);
            $request['stub'] = Kernel::VERSION_ID >= 30200 ? $varCloner->cloneVar($stub) : $stub;
        }

        return $request;
    }
912827
protected static function getIpFromDevice($device)
    {
        if(isset($device['ip'])){
            return $device['ip'];
        }
        if(isset($device['_sender'])){
            $sender = $device['_sender'];
            $ip = substr($sender, 0, strpos($sender, ':'));
            return $ip;
        }

        throw new \RuntimeException('No IP found for device ' . implode(', ', $device));
    }
17124
protected function determineClientIpAddress($request)
    {
        $ipAddress = null;

        $serverParams = $request->getServerParams();
        if (isset($serverParams['REMOTE_ADDR']) && $this->isValidIpAddress($serverParams['REMOTE_ADDR'])) {
            $ipAddress = $serverParams['REMOTE_ADDR'];
        }

        $checkProxyHeaders = $this->checkProxyHeaders;
        if ($checkProxyHeaders && !empty($this->trustedProxies)) {
            if (!in_array($ipAddress, $this->trustedProxies)) {
                $checkProxyHeaders = false;
            }
        }

        if ($checkProxyHeaders) {
            foreach ($this->headersToInspect as $header) {
                if ($request->hasHeader($header)) {
                    $ip = trim(current(explode(',', $request->getHeaderLine($header))));
                    if ($this->isValidIpAddress($ip)) {
                        $ipAddress = $ip;
                        break;
                    }
                }
            }
        }

        return $ipAddress;
    }
190110
protected function resolveRequestSignature($request)
    {
        $route = $request->route()[1];

        if (! $route) {
            throw new RuntimeException('Unable to generate fingerprint. Route unavailable.');
        }

        return \sha1(
            \implode('|', $route['version']).'|'.$request->fullUrl().'|'.$request->ip()
        );
    }
1310244
protected function getIds( $request )
	{
		$ids = [];

		if( isset( $request->data ) )
		{
			foreach( (array) $request->data as $entry )
			{
				if( isset( $entry->id ) ) {
					$ids[] = $entry->id;
				}
			}
		}

		return $ids;
	}
819608
public static function getNameId($request, $key = null)
    {
        $nameId = self::getNameIdData($request, $key);
        return $nameId['Value'];
    }
203553
private function getUri(Request $request): string
    {
        if ($request->attributes->has('ngbmContextUri')) {
            return $request->attributes->get('ngbmContextUri');
        }

        return $request->getRequestUri();
    }
34091
public function getValueFromRequest(\Illuminate\Http\Request $request)
    {
        if ($request->hasSession() && ! is_null($value = $request->old($this->getPath()))) {
            return $value;
        }

        return $request->input($this->getPath());
    }
936894
protected function getResourceId(Request $request)
    {
        if ($resourceId = $request->get('viaResourceId')) {
            return $resourceId;
        };

        parse_str(parse_url($request->server->get('HTTP_REFERER'), PHP_URL_QUERY), $params);

        if ($resourceId = array_get($params, 'viaResourceId')) {
            return $resourceId;
        };

        if ($resourceId = $request->route('resourceId')) {
            return $resourceId;
        };

        return null;
    }
1276654
protected function getRequestToken($request)
    {
        $name = $this->getName();
        $header = 'X-' . ucwords(strtolower($name));
        if ($token = $request->getHeader($header)) {
            return $token;
        }

        // Get from request var
        return $request->requestVar($name);
    }
606175
private function getEncryptedValue(DecryptRequest $request)
    {
        if (!$request->getEncryptedValue()) {
            $plaintextValue = $request->getEncryptedQuestionAsker()->askQuestion();
        } else {
            $plaintextValue = $request->getEncryptedValue();
        }

        return $plaintextValue;
    }
1289334
protected function recordFromRequest($request)
    {
        if (!SecurityToken::inst()->checkRequest($request)) {
            return $this->respondWithMessage(false);
        }

        $id = $request->param('ID');

        if (!$id || !is_numeric($id)) {
            return $this->respondWithMessage(false, "Cannot find record with ID: '$id'", 400);
        }

        $class = $this->owner->config()->tree_class ?: 'SiteTree';
        $record = OriginalDataObject::get_by_id($class, $id);

        if (!$record || !$record->ID) {
            return $this->respondWithMessage(false, "Bad record ID: '$id''", 404);
        }

        return $record;
    }