ReadOnlyStorage.php in Drupal 9
File
core/lib/Drupal/Core/Config/ReadOnlyStorage.php
View source
<?php
namespace Drupal\Core\Config;
class ReadOnlyStorage implements StorageInterface {
protected $storage;
public function __construct(StorageInterface $storage) {
$this->storage = $storage;
}
public function exists($name) {
return $this->storage
->exists($name);
}
public function read($name) {
return $this->storage
->read($name);
}
public function readMultiple(array $names) {
return $this->storage
->readMultiple($names);
}
public function write($name, array $data) {
throw new \BadMethodCallException(__METHOD__ . ' is not allowed on a ReadOnlyStorage');
}
public function delete($name) {
throw new \BadMethodCallException(__METHOD__ . ' is not allowed on a ReadOnlyStorage');
}
public function rename($name, $new_name) {
throw new \BadMethodCallException(__METHOD__ . ' is not allowed on a ReadOnlyStorage');
}
public function encode($data) {
return $this->storage
->encode($data);
}
public function decode($raw) {
return $this->storage
->decode($raw);
}
public function listAll($prefix = '') {
return $this->storage
->listAll($prefix);
}
public function deleteAll($prefix = '') {
throw new \BadMethodCallException(__METHOD__ . ' is not allowed on a ReadOnlyStorage');
}
public function createCollection($collection) {
return new static($this->storage
->createCollection($collection));
}
public function getAllCollectionNames() {
return $this->storage
->getAllCollectionNames();
}
public function getCollectionName() {
return $this->storage
->getCollectionName();
}
}
Classes
Name |
Description |
ReadOnlyStorage |
A ReadOnlyStorage decorates a storage and does not allow writing to it. |