public static function parseAnnotation(\Reflector $ref, $name)
{
static $ok;
if (!$ok) {
if (!(new \ReflectionMethod(__METHOD__))->getDocComment()) {
throw new Nette\InvalidStateException('You have to enable phpDoc comments in opcode cache.');
}
$ok = TRUE;
}
$name = preg_quote($name, '#');
if ($ref->getDocComment() && preg_match("#[\\s*]@{$name}(?:\\s++([^@]\\S*)?|\$)#", trim($ref->getDocComment(), '/*'), $m)) {
return isset($m[1]) ? $m[1] : '';
}
}