
| Current Path : /var/www/html/ift/web/core/lib/Drupal/Core/KeyValueStore/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/ift/web/core/lib/Drupal/Core/KeyValueStore/StorageBase.php |
<?php
namespace Drupal\Core\KeyValueStore;
/**
* Provides a base class for key/value storage implementations.
*/
abstract class StorageBase implements KeyValueStoreInterface {
/**
* The name of the collection holding key and value pairs.
*
* @var string
*/
protected $collection;
/**
* {@inheritdoc}
*/
public function __construct($collection) {
$this->collection = $collection;
}
/**
* {@inheritdoc}
*/
public function getCollectionName() {
return $this->collection;
}
/**
* {@inheritdoc}
*/
public function get($key, $default = NULL) {
$values = $this->getMultiple([$key]);
return isset($values[$key]) ? $values[$key] : $default;
}
/**
* {@inheritdoc}
*/
public function setMultiple(array $data) {
foreach ($data as $key => $value) {
$this->set($key, $value);
}
}
/**
* {@inheritdoc}
*/
public function delete($key) {
$this->deleteMultiple([$key]);
}
}