/** * Avos\Client::initialize, must be called before using Avos features. * * @param string $app_id Avos Application ID * @param string $app_key Avos REST API Key * @param string $master_key Avos Master Key * * @return null */ public static function initialize($app_id, $app_key, $master_key) { AVUser::registerSubclass(); AVRole::registerSubclass(); AVInstallation::registerSubclass(); self::$applicationId = $app_id; self::$appKey = $app_key; self::$masterKey = $master_key; if (!static::$storage) { if (session_status() === PHP_SESSION_ACTIVE) { self::setStorage(new AVSessionStorage()); } else { self::setStorage(new AVMemoryStorage()); } } }
/** * Check whether the role is valid or not. * * @param AVRole $role * * @throws \Exception */ private static function validateRoleState($role) { if (!$role->getObjectId()) { throw new \Exception("Roles must be saved to the server before they can be used in an ACL."); } }