/** * Destroy the current session */ public static function destroySession() { self::$accessToken = null; self::$signedRequest = null; self::$user = null; self::clearAllPersistentData(); // Javascript sets a cookie that will be used in getSignedRequest that we // need to clear if we can $cookie_name = self::getSignedRequestCookieName(); if (array_key_exists($cookie_name, $_COOKIE)) { unset($_COOKIE[$cookie_name]); if (!headers_sent()) { $base_domain = self::getBaseDomain(); setcookie($cookie_name, '', 1, '/', '.' . $base_domain); } else { // @codeCoverageIgnoreStart self::errorLog('There exists a cookie that we wanted to clear that we couldn\'t ' . 'clear because headers was already sent. Make sure to do the first ' . 'API call before outputing anything.'); // @codeCoverageIgnoreEnd } } }