function url_alter_get_function_info in URL alter 6
Fetch information about a function using reflection.
Parameters
$function: The name of the function.
Return value
A ReflectionFunction object with added file, code, and location attributes, or FALSE if the function does not exist.
1 call to url_alter_get_function_info()
- url_alter_requirements in ./
url_alter.install - Implementation of hook_requirements().
File
- ./
url_alter.module, line 139
Code
function url_alter_get_function_info($function) {
if (!function_exists($function) || !class_exists('ReflectionFunction')) {
return FALSE;
}
$info = new ReflectionFunction($function);
$info->file = trim(substr($info
->getFileName(), strlen(getcwd())), '\\/');
$info->location = t('line @line in @file', array(
'@file' => $info->file,
'@line' => $info
->getStartLine(),
));
$file_contents = file_get_contents($info
->getFileName());
$file_contents = explode("\n", $file_contents);
$info->code = array_slice($file_contents, $info
->getStartLine(), $info
->getEndLine() - $info
->getStartLine() - 1);
$info->code = implode("\n", $info->code);
return $info;
}