protected function getFromHeader(ServerRequestInterface $request)
    {
        $accept = $request->getHeaderLine('Accept-Language');

        if ( empty($accept) || empty($this->languages) ) {
            return;
        }

        $language = (new Negotiator())->getBest($accept, $this->languages);

        if ( $language ) {
            return $language->getValue();
        }
    }
protected function getFromHeader(ServerRequestInterface $request)
    {
        $accept = $request->getHeaderLine('Accept-Language');

        if ( empty($accept) || empty($this->languages) ) {
            return;
        }

        $language = (new Negotiator())->getBest($accept, $this->languages);

        if ( $language ) {
            return $language->getValue();
        }
    }
protected function getFromHeader ( ServerRequestInterface $ request ) { $ accept = $ request -> getHeaderLine ( 'Accept-Language' ) ; if ( empty ( $ accept ) || empty ( $ this -> languages ) ) { return ; } $ language = ( new Negotiator ( ) ) -> getBest ( $ accept , $ this -> languages ) ; if ( $ language ) { return $ language -> getValue ( ) ; } }
Retrieve the language using the Accept-Language header.

@param  RequestInterface  $request  PSR7 request object

@return null|string
Retrieve the language using the Accept - Language header .