Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding options parameter to `Config` methods.

  • Loading branch information...
commit 8d4cd240bc1b72da0010ee86a337a58130a3c053 1 parent 0b1759c
@farhadi authored
Showing with 12 additions and 12 deletions.
  1. +9 −9 storage/Config.php
  2. +3 −3 storage/config/adapter/Db.php
View
18 storage/Config.php
@@ -110,33 +110,33 @@ public static function __callStatic($method, $arguments) {
}
}
- public static function read($name, $key) {
+ public static function read($name, $key, array $options = array()) {
$settings = static::_config($name);
- $params = compact('name', 'key');
+ $params = compact('name', 'key', 'options');
$filters = $settings['filters'][__FUNCTION__];
return static::_filter(__FUNCTION__, $params, function($self, $params) {
extract($params);
- return $self::adapter($name)->read($key);
+ return $self::adapter($name)->read($key, $options);
}, $filters);
}
- public static function write($name, $key, $value) {
+ public static function write($name, $key, $value, array $options = array()) {
$settings = static::_config($name);
- $params = compact('name', 'key', 'value');
+ $params = compact('name', 'key', 'value', 'options');
$filters = $settings['filters'][__FUNCTION__];
return static::_filter(__FUNCTION__, $params, function($self, $params) {
extract($params);
- return $self::adapter($name)->write($key, $value);
+ return $self::adapter($name)->write($key, $value, $options);
}, $filters);
}
- public static function delete($name, $key) {
+ public static function delete($name, $key, array $options = array()) {
$settings = static::_config($name);
- $params = compact('name', 'key');
+ $params = compact('name', 'key', 'options');
$filters = $settings['filters'][__FUNCTION__];
return static::_filter(__FUNCTION__, $params, function($self, $params) {
extract($params);
- return $self::adapter($name)->delete($key);
+ return $self::adapter($name)->delete($key, $options);
}, $filters);
}
}
View
6 storage/config/adapter/Db.php
@@ -21,7 +21,7 @@ public function __construct(array $config = array()) {
$this->_config['fields'] = array_combine(array('key', 'value'), $this->_config['fields']);
}
- public function read($key) {
+ public function read($key, array $options = array()) {
$model = $this->_config['model'];
$fields = $this->_config['fields'];
$model = Libraries::locate('models', $model);
@@ -34,7 +34,7 @@ public function read($key) {
}
}
- public function write($key, $value) {
+ public function write($key, $value, array $options = array()) {
$model = $this->_config['model'];
$fields = $this->_config['fields'];
$model = Libraries::locate('models', $model);
@@ -43,7 +43,7 @@ public function write($key, $value) {
return $config->save(array($fields['key'] => $key, $fields['value'] => $value));
}
- public function delete($key) {
+ public function delete($key, array $options = array()) {
$model = $this->_config['model'];
$fields = $this->_config['fields'];
$model = Libraries::locate('models', $model);
Please sign in to comment.
Something went wrong with that request. Please try again.