protected function getFromPath(ServerRequestInterface $request)
    {
        $uri   = $request->getUri();
        $regex = '~^\/?' . $this->getRegEx() . '\b~';
        $path = rtrim( $uri->getPath(), '/\\' ) . '/';

        if ( preg_match($regex, $path, $matches) ) {
            if (isset($matches['language'])) {
                return $matches['language'];
            } else {
                throw new RuntimeException('The regular expression pattern is missing a named subpattern "language".');
            }
        }
    }
protected function getFromPath(ServerRequestInterface $request)
    {
        $uri   = $request->getUri();
        $regex = '~^\/?' . $this->getRegEx() . '\b~';
        $path = rtrim( $uri->getPath(), '/\\' ) . '/';

        if ( preg_match($regex, $path, $matches) ) {
            if (isset($matches['language'])) {
                return $matches['language'];
            } else {
                throw new RuntimeException('The regular expression pattern is missing a named subpattern "language".');
            }
        }
    }
protected function getFromPath ( ServerRequestInterface $ request ) { $ uri = $ request -> getUri ( ) ; $ regex = '~^\/?' . $ this -> getRegEx ( ) . '\b~' ; $ path = rtrim ( $ uri -> getPath ( ) , '/\\' ) . '/' ; if ( preg_match ( $ regex , $ path , $ matches ) ) { if ( isset ( $ matches [ 'language' ] ) ) { return $ matches [ 'language' ] ; } else { throw new RuntimeException ( 'The regular expression pattern is missing a named subpattern "language".' ) ; } } }
Retrieve the language from the requested URI.

@param  RequestInterface  $request  PSR7 request object

@return null|string
Retrieve the language from the requested URI .