public final function parse(IFunctionReflection $reflection)
{
$innerReflection = $reflection->getInnerReflection();
if (!$innerReflection->isUserDefined()) {
throw new InvalidFunctionException('Cannot parse function %s: function is not user defined', $innerReflection->getName());
}
$filePath = $reflection->getLocation()->getFilePath();
if (!is_readable($filePath)) {
throw new InvalidFunctionException('Cannot parse function %s: \'%s\' is not a valid accessible file', $innerReflection->getName(), $filePath);
}
try {
return $this->parseFunction($reflection, $filePath);
} catch (ASTException $astException) {
throw InvalidFunctionException::invalidFunctionMessage($astException->getMessage(), $innerReflection);
}
}