class StateWrapper
Class StateWrapper.
Hierarchy
- class \Drupal\webprofiler\State\StateWrapper extends \Drupal\Core\Cache\CacheCollector implements \Drupal\Core\State\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
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
StateWrapper::$dataCollector | private | property | The state data collector. |
StateWrapper::$state | private | property | The system state. |
StateWrapper::delete | public | function | |
StateWrapper::deleteMultiple | public | function | |
StateWrapper::destruct | public | function | |
StateWrapper::get | public | function | |
StateWrapper::getMultiple | public | function | |
StateWrapper::resetCache | public | function | |
StateWrapper::resolveCacheMiss | protected | function | |
StateWrapper::set | public | function | |
StateWrapper::setMultiple | public | function | |
StateWrapper::__call | public | function | Passes through all non-tracked calls onto the decorated object. |
StateWrapper::__construct | public | function | StateWrapper constructor. |