attribute = plugin_load('helper', 'attribute'); if ($this->attribute === null) throw new \RuntimeException('attribute plugin not found'); $this->providerID = $module; $this->user = $user; } /** * Check if a setting exists * * @param string $key Settings key * @return bool */ public function has($key) { return $this->attribute->exists($this->providerID, $key, $this->user); } /** * Get a stored setting * * @param string $key Settings key * @param mixed $default Default to return when no setting available * @return mixed */ public function get($key, $default = null) { $success = false; $data = $this->attribute->get($this->providerID, $key, $success, $this->user); if (!$success) return $default; return $data; } /** * Store a settings value * * @param string $key Settings key * @param mixed $value Value to store * @return bool */ public function set($key, $value) { return $this->attribute->set($this->providerID, $key, $value, $this->user); } /** * Delete a settings value * * @param string $key Settings key * @return bool */ public function delete($key) { return $this->attribute->del($this->providerID, $key, $this->user); } /** * Remove all settings * * @return bool */ public function purge() { return $this->attribute->purge($this->providerID, $this->user); } }