You are here

function _git_deploy_static in Git Deploy 6.2

Same name and namespace in other branches
  1. 6 git_deploy.module \_git_deploy_static()

Stores shared static variables for Git Deploy.

Parameters

string|NULL $name: Unique variable name. If omitted, all variables.

$default_value: Value to store.

bool $reset: Internal: TRUE to reset one or all variables.

3 calls to _git_deploy_static()
git_deploy_mydropwizard_projects_alter in ./git_deploy.module
Implements hook_mydropwizard_projects_alter().
git_deploy_system_info_alter in ./git_deploy.module
Implements hook_system_info_alter().
_git_deploy_static_reset in ./git_deploy.module
Resets one or all Git Deploy static variables.

File

./git_deploy.module, line 34
Adds project, version and date information to projects checked out with Git.

Code

function &_git_deploy_static($name, $default_value = NULL, $reset = FALSE) {
  static $data = array(), $default = array();
  if (isset($name)) {
    if (array_key_exists($name, $data)) {
      if ($reset) {
        $data[$name] = $default[$name];
      }
    }
    else {
      $data[$name] = $default[$name] = $default_value;
    }
    return $data[$name];
  }
  elseif ($reset) {
    foreach ($default as $name => $value) {
      $data[$name] = $default[$name];
    }
  }
  return $data;
}