Explorar o código

Add a method to change the configuration setter

See https://github.com/FreshRSS/FreshRSS/issues/730
Marien Fressinaud %!s(int64=11) %!d(string=hai) anos
pai
achega
7f12058fab
Modificáronse 1 ficheiros con 12 adicións e 1 borrados
  1. 12 1
      lib/Minz/Configuration.php

+ 12 - 1
lib/Minz/Configuration.php

@@ -127,7 +127,18 @@ class Minz_Configuration {
 			$this->data_default = self::load($this->default_filename);
 		}
 
-		$this->configuration_setter = $configuration_setter;
+		$this->_configurationSetter($configuration_setter);
+	}
+
+	/**
+	 * Set a configuration setter for the current configuration.
+	 * @param $configuration_setter the setter to call when modifying data. It
+	 *        must implement an handle($key, $value) method.
+	 */
+	public function _configurationSetter($configuration_setter) {
+		if (is_callable(array($configuration_setter, 'handle'))) {
+			$this->configuration_setter = $configuration_setter;
+		}
 	}
 
 	/**