public static function getCurrentUser()
    {
        if (static::$currentUser instanceof AVUser)
        {
            return static::$currentUser;
        }
        $storage = AVClient::getStorage();
        $userData = $storage->get("user");
        if ($userData instanceof AVUser)
        {
            static::$currentUser = $userData;

            return $userData;
        }
        if (isset($userData["id"]) && isset($userData["_sessionToken"]))
        {
            $user = AVUser::create("_User", $userData["id"]);
            unset($userData["id"]);
            $user->_sessionToken = $userData["_sessionToken"];
            unset($userData["_sessionToken"]);
            foreach ($userData as $key => $value)
            {
                $user->set($key, $value);
            }
            $user->_opSetQueue = array();
            static::$currentUser = $user;

            return $user;
        }

        return null;
    }
public static function getCurrentUser()
    {
        if (static::$currentUser instanceof AVUser)
        {
            return static::$currentUser;
        }
        $storage = AVClient::getStorage();
        $userData = $storage->get("user");
        if ($userData instanceof AVUser)
        {
            static::$currentUser = $userData;

            return $userData;
        }
        if (isset($userData["id"]) && isset($userData["_sessionToken"]))
        {
            $user = AVUser::create("_User", $userData["id"]);
            unset($userData["id"]);
            $user->_sessionToken = $userData["_sessionToken"];
            unset($userData["_sessionToken"]);
            foreach ($userData as $key => $value)
            {
                $user->set($key, $value);
            }
            $user->_opSetQueue = array();
            static::$currentUser = $user;

            return $user;
        }

        return null;
    }
public static function getCurrentUser ( ) { if ( static :: $ currentUser instanceof AVUser ) { return static :: $ currentUser ; } $ storage = AVClient :: getStorage ( ) ; $ userData = $ storage -> get ( "user" ) ; if ( $ userData instanceof AVUser ) { static :: $ currentUser = $ userData ; return $ userData ; } if ( isset ( $ userData [ "id" ] ) && isset ( $ userData [ "_sessionToken" ] ) ) { $ user = AVUser :: create ( "_User" , $ userData [ "id" ] ) ; unset ( $ userData [ "id" ] ) ; $ user -> _sessionToken = $ userData [ "_sessionToken" ] ; unset ( $ userData [ "_sessionToken" ] ) ; foreach ( $ userData as $ key => $ value ) { $ user -> set ( $ key , $ value ) ; } $ user -> _opSetQueue = array ( ) ; static :: $ currentUser = $ user ; return $ user ; } return null ; }
Retrieves the currently logged in AVUser with a valid session,
either from memory or the storage provider, if necessary.

@return AVUser|null
Retrieves the currently logged in AVUser with a valid session either from memory or the storage provider if necessary .