StateWrapper.php in Devel 4.x
File
webprofiler/src/State/StateWrapper.php
View source
<?php
namespace Drupal\webprofiler\State;
use Drupal\Core\Cache\CacheCollector;
use Drupal\Core\State\StateInterface;
use Drupal\webprofiler\DataCollector\StateDataCollector;
class StateWrapper extends CacheCollector implements StateInterface {
private $state;
private $dataCollector;
public function __construct(StateInterface $state, StateDataCollector $dataCollector) {
$this->state = $state;
$this->dataCollector = $dataCollector;
}
public function get($key, $default = NULL) {
$this->dataCollector
->addState($key);
return $this->state
->get($key, $default);
}
public function getMultiple(array $keys) {
foreach ($keys as $key) {
$this->dataCollector
->addState($key);
}
return $this->state
->getMultiple($keys);
}
public function set($key, $value) {
$this->state
->set($key, $value);
}
public function setMultiple(array $data) {
$this->state
->setMultiple($data);
}
public function delete($key) {
$this->state
->delete($key);
}
public function deleteMultiple(array $keys) {
$this->state
->deleteMultiple($keys);
}
public function resetCache() {
$this->state
->resetCache();
}
protected function resolveCacheMiss($key) {
return $this->state
->resolveCacheMiss($key);
}
public function destruct() {
$this
->updateCache();
}
public function __call($method, $args) {
return call_user_func_array([
$this->state,
$method,
], $args);
}
}