public function DrupalStatic::resetKey in X Autoload 7.5
Replicates drupal_static($name, NULL, TRUE).
Parameters
string $name:
Return value
array
See also
File
- tests/
src/ VirtualDrupal/ DrupalStatic.php, line 53
Class
Namespace
Drupal\xautoload\Tests\VirtualDrupalCode
public function &resetKey($name) {
if (!isset($name)) {
throw new \InvalidArgumentException('$name cannot be NULL.');
}
// First check if dealing with a previously defined static variable.
if (isset($this->data[$name]) || array_key_exists($name, $this->data)) {
// Non-NULL $name and both $this->data[$name] and $this->default[$name] statics exist.
// Reset pre-existing static variable to its default value.
$this->data[$name] = $this->default[$name];
return $this->data[$name];
}
// Neither $this->data[$name] nor $this->default[$name] static variables exist.
// Reset was called before a default is set and yet a variable must be
// returned.
return $this->data;
}