/** * Add a configuration to be managed * * When added, the value for the configuration will * be read from the optional storage. * * @param mr_config_interface $config * @return mr_config_collection * @throws coding_exception */ public function add(mr_config_interface $config) { if ($this->has($config->get_name())) { throw new coding_exception("Configuration already exists with name {$config->get_name()}"); } $this->configs[$config->get_name()] = $config; if ($this->storage instanceof mr_config_storage_interface) { $this->storage->read($config); } return $this; }
public function remove(mr_config_interface $config) { $name = $config->get_name(); unset_config($name, $this->component); if (!is_null($this->cache) and property_exists($this->cache, $name)) { unset($this->cache->{$name}); } }