public function __destruct() { Oasys::getStore()->merge($this->toArray()); parent::__destruct(); }
/** * @return \DreamFactory\Oasys\Interfaces\StorageProviderLike */ public function getStore() { return Oasys::getStore(); }
/** * Makes a list of available templates * * @param string $pattern * * @return void */ protected static function _loadTemplates($pattern = self::DEFAULT_TEMPLATE_PATTERN) { if (array() !== (static::$_templateCache = Oasys::getStore()->get('oasys.template_cache', array()))) { // Loaded from cache... return; } $_list = array(); foreach (static::$_providerPaths as $_path) { $_templates = glob($_path . '/Templates/' . $pattern); foreach ($_templates as $_template) { $_templateName = str_ireplace('.template.php', null, basename($_template)); $_templateId = Inflector::neutralize($_templateName); // Skip base classes in these directories... if ('base_' == substr($_templateId, 0, 4)) { continue; } $_list[$_templateId] = $_path . '/Templates/' . $_template; unset($_template, $_templateId, $_templateName); } unset($_path, $_templates); } // Merge in the found templates Oasys::getStore()->set('oasys.template_cache', static::$_templateCache = array_merge(static::$_templateCache, $_list)); Log::debug('Cached templates: ' . implode(', ', array_keys(static::$_templateCache))); }
/** * Retrieves the users' profile from the provider and stores it */ protected function _updateUserProfile() { $_profile = $this->getUserData(); if (!empty($_profile)) { // For us... $_profile->setProviderId($this->_providerId); $this->setConfig('provider_user_id', $_id = $_profile->getUserId()); // For posterity - Check if method exists so testing works. /** @noinspection PhpUndefinedMethodInspection */ if (method_exists(Oasys::getStore(), 'setProviderUserId')) { Oasys::getStore()->setProviderUserId($_id); } // A tag Log::debug('User profile updated [' . $this->_providerId . ':' . $_id . ']'); } }