protected function determineClientUserAgent($request)
    {
        $userAgent = null;
        $serverParams = $request->getServerParams();
        $userAgent = $serverParams['HTTP_USER_AGENT'];

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

        if ($checkProxyHeaders) {
            foreach ($this->headersToInspect as $header) {
                if ($request->hasHeader($header)) {
                    $userAgent = trim(current(explode(',', $request->getHeaderLine($header))));
                    break;
                }
            }
        }
        return $userAgent;
    }
protected function determineClientUserAgent($request)
    {
        $userAgent = null;
        $serverParams = $request->getServerParams();
        $userAgent = $serverParams['HTTP_USER_AGENT'];

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

        if ($checkProxyHeaders) {
            foreach ($this->headersToInspect as $header) {
                if ($request->hasHeader($header)) {
                    $userAgent = trim(current(explode(',', $request->getHeaderLine($header))));
                    break;
                }
            }
        }
        return $userAgent;
    }
protected function determineClientUserAgent ( $ request ) { $ userAgent = null ; $ serverParams = $ request -> getServerParams ( ) ; $ userAgent = $ serverParams [ 'HTTP_USER_AGENT' ] ; $ checkProxyHeaders = $ this -> checkProxyHeaders ; if ( $ checkProxyHeaders && ! empty ( $ this -> trustedProxies ) ) { if ( ! in_array ( $ userAgent , $ this -> trustedProxies ) ) { $ checkProxyHeaders = false ; } } if ( $ checkProxyHeaders ) { foreach ( $ this -> headersToInspect as $ header ) { if ( $ request -> hasHeader ( $ header ) ) { $ userAgent = trim ( current ( explode ( ',' , $ request -> getHeaderLine ( $ header ) ) ) ) ; break ; } } } return $ userAgent ; }
Find out the client's UserAgent from the headers available to us

@param  ServerRequestInterface $request PSR-7 Request
@return string
Find out the client s UserAgent from the headers available to us