Commit 5d768ef3 authored by martin107's avatar martin107 Committed by Luca Lusso
Browse files

Issue #2841689 by martin107: StateWrapper does not implement destruct()

parent 7254406f
......@@ -6,23 +6,31 @@ use Drupal\Core\State\StateInterface;
use Drupal\webprofiler\DataCollector\StateDataCollector;
/**
* Class StateWrapper
* Class StateWrapper.
*/
class StateWrapper 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;
......@@ -83,4 +91,20 @@ class StateWrapper implements StateInterface {
public function resetCache() {
$this->state->resetCache();
}
/**
* 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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment