/**
 * Get the key of the current client session.
 *
 * @return string Session key
 *
 * @throws Exception Throws if an error occurred.
 */
function getSessionKey()
{
    // Return the key from the globals if set
    if (isset($GLOBALS['session_key'])) {
        return $GLOBALS['session_key'];
    }
    // Get the session cookie name
    $sessionCookieName = Registry::getValue('client.session.cookie.name')->getValue();
    // Get the session key
    $sessionKey = CookieManager::getCookie($sessionCookieName);
    // Set the session key global
    $GLOBALS['session_key'] = $sessionKey;
    // Return the session key
    return $sessionKey;
}
 /**
  * Get the language tag from the user's cookie if specified.
  *
  * @return string|null The language tag, or null if not set.
  */
 public static function getCookieLanguageTag()
 {
     return CookieManager::getCookie(static::LANGUAGE_COOKIE_NAME);
 }