/**
* @param \Doctrine\Common\Annotations\AnnotationException $e
*
* @return string
*/
public static function highlightAnnotationLine(AnnotationException $e)
{
foreach ($e->getTrace() as $step) {
if (@$step['class'] . @$step['type'] . @$step['function'] !== 'Doctrine\\Common\\Annotations\\DocParser->parse') {
continue;
}
$context = Strings::match($step['args'][1], '~^(?P<type>[^\\s]+)\\s*(?P<class>[^:]+)(?:::\\$?(?P<property>[^\\(]+))?$~i');
break;
}
if (!isset($context)) {
return FALSE;
}
$refl = Nette\Reflection\ClassType::from($context['class']);
$file = $refl->getFileName();
$line = NULL;
if ($context['type'] === 'property') {
$refl = $refl->getProperty($context['property']);
$line = Kdyby\Doctrine\Helpers::getPropertyLine($refl);
} elseif ($context['type'] === 'method') {
$refl = $refl->getProperty($context['method']);
}
if (($errorLine = self::calculateErrorLine($refl, $e, $line)) === NULL) {
return FALSE;
}
$dump = BlueScreen::highlightFile($file, $errorLine);
return '<p><b>File:</b> ' . self::editorLink($file, $errorLine) . '</p>' . $dump;
}