You are here

function _radioactivity_get_storage in Radioactivity 7.2

Get storage by key

1 call to _radioactivity_get_storage()
radioactivity_get_field_profile in ./radioactivity.module
Get an instance of incident storage by params

File

./radioactivity.module, line 387
Radioactivity core functionality

Code

function _radioactivity_get_storage($key) {
  static $cache = array();

  // if cached?
  if (!isset($cache[$key])) {
    $class = "Radioactivity" . ucfirst($key) . "IncidentStorage";
    if (class_exists($class)) {
      $cache[$key] = new $class();
    }
    else {
      watchdog('radioactivity', 'Tried to use a storage @class that is not defined.', array(
        '@class' => $class,
        WATCHDOG_CRITICAL,
      ));
      return FALSE;
    }
  }
  return $cache[$key];
}