public static function write($key, $value = null, array $options = array())
{
$defaults = array('name' => null, 'strategies' => true);
$options += $defaults;
if (is_resource($value) || !static::$_configurations) {
return false;
}
$methods = array();
if ($name = $options['name']) {
$methods = array($name => static::adapter($name)->write($key, $value, $options));
} else {
foreach (array_keys(static::$_configurations) as $name) {
if ($method = static::adapter($name)->write($key, $value, $options)) {
$methods[$name] = $method;
}
}
}
$result = false;
$original = $value;
foreach ($methods as $name => $method) {
$settings = static::_config($name);
$filters = $settings['filters'];
if ($options['strategies']) {
$options += array('key' => $key, 'class' => __CLASS__);
$value = static::applyStrategies(__FUNCTION__, $name, $original, $options);
}
$params = compact('key', 'value', 'options');
$result = static::_filter(__FUNCTION__, $params, $method, $filters) || $result;
}
return $result;
}