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".');
            }
        }
    }