class StateWrapper in Devel 8
Same name and namespace in other branches
- 8.3 webprofiler/src/State/StateWrapper.php \Drupal\webprofiler\State\StateWrapper
- 8.2 webprofiler/src/State/StateWrapper.php \Drupal\webprofiler\State\StateWrapper
- 4.x webprofiler/src/State/StateWrapper.php \Drupal\webprofiler\State\StateWrapper
Class StateWrapper.
Hierarchy
- class \Drupal\Core\Cache\CacheCollector implements CacheCollectorInterface, DestructableInterface
- class \Drupal\webprofiler\State\StateWrapper implements StateInterface
Expanded class hierarchy of StateWrapper
1 string reference to 'StateWrapper'
- webprofiler.services.yml in webprofiler/
webprofiler.services.yml - webprofiler/webprofiler.services.yml
1 service uses StateWrapper
File
- webprofiler/
src/ State/ StateWrapper.php, line 12
Namespace
Drupal\webprofiler\StateView source
class StateWrapper extends CacheCollector implements StateInterface {
/**
* The system state.
*
* @var \Drupal\Core\State\StateInterface
*/
private $state;
/**
* The state data collector.
*
* @var \Drupal\webprofiler\DataCollector\StateDataCollector
*/
private $dataCollector;
/**
* StateWrapper constructor.
*
* @param \Drupal\Core\State\StateInterface $state
* The system state.
* @param \Drupal\webprofiler\DataCollector\StateDataCollector $dataCollector
* The state data collector.
*/
public function __construct(StateInterface $state, StateDataCollector $dataCollector) {
$this->state = $state;
$this->dataCollector = $dataCollector;
}
/**
* {@inheritdoc}
*/
public function get($key, $default = NULL) {
$this->dataCollector
->addState($key);
return $this->state
->get($key, $default);
}
/**
* {@inheritdoc}
*/
public function getMultiple(array $keys) {
foreach ($keys as $key) {
$this->dataCollector
->addState($key);
}
return $this->state
->getMultiple($keys);
}
/**
* {@inheritdoc}
*/
public function set($key, $value) {
$this->state
->set($key, $value);
}
/**
* {@inheritdoc}
*/
public function setMultiple(array $data) {
$this->state
->setMultiple($data);
}
/**
* {@inheritdoc}
*/
public function delete($key) {
$this->state
->delete($key);
}
/**
* {@inheritdoc}
*/
public function deleteMultiple(array $keys) {
$this->state
->deleteMultiple($keys);
}
/**
* {@inheritdoc}
*/
public function resetCache() {
$this->state
->resetCache();
}
/**
* {@inheritdoc}
*/
protected function resolveCacheMiss($key) {
return $this->state
->resolveCacheMiss($key);
}
/**
* {@inheritdoc}
*/
public function destruct() {
$this
->updateCache();
}
/**
* Passes through all non-tracked calls onto the decorated object.
*
* @param string $method
* The called method.
* @param mixed $args
* The passed in arguments.
*
* @return mixed
* The return argument of the call.
*/
public function __call($method, $args) {
return call_user_func_array([
$this->state,
$method,
], $args);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheCollector:: |
protected | property | The cache backend that should be used. | 1 |
CacheCollector:: |
protected | property | Stores the cache creation time. | |
CacheCollector:: |
protected | property | Flag that indicates of the cache has been invalidated. | |
CacheCollector:: |
protected | property | Indicates if the collected cache was already loaded. | |
CacheCollector:: |
protected | property | The cache id that is used for the cache entry. | |
CacheCollector:: |
protected | property | An array of keys to add to the cache on service termination. | |
CacheCollector:: |
protected | property | An array of keys to remove from the cache on service termination. | |
CacheCollector:: |
protected | property | The lock backend that should be used. | 1 |
CacheCollector:: |
protected | property | Storage for the data itself. | |
CacheCollector:: |
protected | property | A list of tags that are used for the cache entry. | |
CacheCollector:: |
public | function |
Clears the collected cache entry. Overrides CacheCollectorInterface:: |
1 |
CacheCollector:: |
protected | function | Gets the cache ID. | 3 |
CacheCollector:: |
public | function |
Returns whether data exists for this key. Overrides CacheCollectorInterface:: |
1 |
CacheCollector:: |
protected | function | Invalidate the cache. | |
CacheCollector:: |
protected | function | Loads the cache if not already done. | 1 |
CacheCollector:: |
protected | function | Normalizes a cache ID in order to comply with database limitations. | |
CacheCollector:: |
protected | function | Flags an offset value to be written to the persistent cache. | |
CacheCollector:: |
public | function |
Resets the local cache. Overrides CacheCollectorInterface:: |
1 |
CacheCollector:: |
protected | function | Writes a value to the persistent cache immediately. | 1 |
StateWrapper:: |
private | property | The state data collector. | |
StateWrapper:: |
private | property | The system state. | |
StateWrapper:: |
public | function |
Deletes an item. Overrides CacheCollector:: |
|
StateWrapper:: |
public | function |
Deletes multiple items. Overrides StateInterface:: |
|
StateWrapper:: |
public | function |
Performs destruct operations. Overrides CacheCollector:: |
|
StateWrapper:: |
public | function |
Returns the stored value for a given key. Overrides CacheCollector:: |
|
StateWrapper:: |
public | function |
Returns the stored key/value pairs for a given set of keys. Overrides StateInterface:: |
|
StateWrapper:: |
public | function |
Resets the static cache. Overrides StateInterface:: |
|
StateWrapper:: |
protected | function |
Resolves a cache miss. Overrides CacheCollector:: |
|
StateWrapper:: |
public | function |
Implements \Drupal\Core\Cache\CacheCollectorInterface::set(). Overrides CacheCollector:: |
|
StateWrapper:: |
public | function |
Saves key/value pairs. Overrides StateInterface:: |
|
StateWrapper:: |
public | function | Passes through all non-tracked calls onto the decorated object. | |
StateWrapper:: |
public | function |
StateWrapper constructor. Overrides CacheCollector:: |