/** * Shared * @return \Touchbase\Data\Store */ public static function shared() { $store = Session::get(self::STORE_SESSION_KEY, new Store()); if (!$store->count()) { Session::set(self::STORE_SESSION_KEY, $store); } return $store; }
/** * Current User * @return \Touchbase\Security\Auth\AuthedUserInterface */ public static function currentUser() { if (!($currentUserCookie = self::shared()->retrieveUserFromCookie())) { return null; } $currentUser = Session::get(self::AUTH_SESSION_KEY); if (!$currentUser || $currentUser->ID() != $currentUserCookie->ID()) { return null; } return $currentUser; }