Commit a834496e authored by Dries's avatar Dries

Issue #1804024 by msonnabaum: Added Remove constructor from k/v interface.

parent 890865c7
......@@ -20,14 +20,12 @@ class DatabaseStorage extends StorageBase {
*
* @param string $collection
* The name of the collection holding key and value pairs.
* @param array $options
* An associative array of options for the key/value storage collection.
* Keys used:
* - table. The name of the SQL table to use, defaults to key_value.
* @param string $table
* The name of the SQL table to use, defaults to key_value.
*/
public function __construct($collection, array $options = array()) {
parent::__construct($collection, $options);
$this->table = isset($options['table']) ? $options['table'] : 'key_value';
public function __construct($collection, $table = 'key_value') {
parent::__construct($collection);
$this->table = $table;
}
/**
......
......@@ -12,16 +12,6 @@
*/
interface KeyValueStoreInterface {
/**
* Constructs a new key/value collection.
*
* @param string $collection
* The name of the collection holding key and value pairs.
* @param array $options
* An associative array of options for the key/value storage collection.
*/
public function __construct($collection, array $options = array());
/**
* Returns the name of this collection.
*
......
......@@ -9,11 +9,8 @@
/**
* Defines a default key/value store implementation.
*
* For performance reasons, this implementation is not based on
* Drupal\Core\KeyValueStore\StorageBase.
*/
class MemoryStorage implements KeyValueStoreInterface {
class MemoryStorage extends StorageBase {
/**
* The actual storage of key-value pairs.
......@@ -22,20 +19,6 @@ class MemoryStorage implements KeyValueStoreInterface {
*/
protected $data = array();
/**
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::__construct().
*/
public function __construct($collection, array $options = array()) {
$this->collection = $collection;
}
/**
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::getCollectionName().
*/
public function getCollectionName() {
return $this->collection;
}
/**
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::get().
*/
......
......@@ -22,7 +22,7 @@ abstract class StorageBase implements KeyValueStoreInterface {
/**
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::__construct().
*/
public function __construct($collection, array $options = array()) {
public function __construct($collection) {
$this->collection = $collection;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment