_registry_get_resource_name(&$tokens = NULL, $type = NULL)
drupal/includes/registry.inc, line 206
Derive the name of the next resource in the token stream.
When called without arguments, it resets its static cache.
$tokens The collection of tokens for the current file being parsed.
$type The human-readable token name, either: "function", "class", or "interface".
The name of the resource, or FALSE if the resource has already been processed.
| Name | Description |
|---|---|
| Code registry | The code registry engine. |
function _registry_get_resource_name(&$tokens = NULL, $type = NULL) {
// Keep a running list of all resources we've saved so far, so that we never
// save one more than once.
static $resources;
if (!isset($tokens)) {
$resources = array();
return;
}
// Determine the name of the resource.
next($tokens); // Eat a space.
$token = next($tokens);
if ($token == '&') {
$token = next($tokens);
}
$resource_name = $token[1];
// Ensure that we never save it more than once.
if (isset($resources[$type][$resource_name])) {
return FALSE;
}
$resources[$type][$resource_name] = TRUE;
return $resource_name;
}