You are here

public static function Vars::staticValue in Variable API 7.2

Same name and namespace in other branches
  1. 6.2 vars.module \Vars::staticValue()
  2. 6 vars.module \Vars::staticValue()
  3. 7 vars.module \Vars::staticValue()

Central static variable storage.

This static method is provided for compatibility with code using Drupal 6; code for Drupal 7 should use the function provided by Drupal.

Parameters

$name: Globally unique name for the variable. For a function with only one static variable, the function name (e.g. via the PHP magic __FUNCTION__ constant) is recommended. For a function with multiple static variables add a distinguishing suffix to the function name for each one.

$default_value: Optional default value.

$reset: TRUE to reset a specific named variable, or all variables if $name is NULL. Resetting every variable should only be used, for example, for running unit tests with a clean environment. Should be used only though via function vars_static_reset() and the return value should not be used in this case.

Return value

Returns a variable by reference.

2 calls to Vars::staticValue()
Vars::getLibraryPath in ./vars.classes.inc
Returns the list of the directories where library files are looked in.
Vars::offsetGet in ./vars.classes.inc
Implements ArrayAccess::offsetGet().

File

./vars.classes.inc, line 489
Classes implemented by the Variable API module.

Class

Vars
@file Classes implemented by the Variable API module.

Code

public static function &staticValue($name, $default_value = NULL, $reset = FALSE) {
  return drupal_static($name, $default_value, $reset);
}