public function getUserLanguage(ServerRequestInterface $request = null)
    {
        if (
            $this->saveInSession &&
            isset($_SESSION['language']) &&
            $this->isSupported($_SESSION['language'])
        ) {
            return $_SESSION['language'];
        }

        if ( empty($language) && $request instanceof ServerRequestInterface ) {
            return $this->getFromHeader($request);
        }

        return null;
    }
public function getUserLanguage(ServerRequestInterface $request = null)
    {
        if (
            $this->saveInSession &&
            isset($_SESSION['language']) &&
            $this->isSupported($_SESSION['language'])
        ) {
            return $_SESSION['language'];
        }

        if ( empty($language) && $request instanceof ServerRequestInterface ) {
            return $this->getFromHeader($request);
        }

        return null;
    }
public function getUserLanguage ( ServerRequestInterface $ request = null ) { if ( $ this -> saveInSession && isset ( $ _SESSION [ 'language' ] ) && $ this -> isSupported ( $ _SESSION [ 'language' ] ) ) { return $ _SESSION [ 'language' ] ; } if ( empty ( $ language ) && $ request instanceof ServerRequestInterface ) { return $ this -> getFromHeader ( $ request ) ; } return null ; }
Retrieve the user's preferred language

Looks in the user session and the Accept-Language header
if a request is provided. If the language is not part of
the supported set, returns the fallback language.

@param  RequestInterface  $request  PSR7 request object

@return string|null
Retrieve the user s preferred language