Skip to content

Commit bf1e53b

Browse files
Also generate link for traits and functions.
1 parent c372640 commit bf1e53b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

PHP/CodeCoverage/Report/Node/File.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,8 @@ protected function processTraits(PHP_Token_Stream $tokens)
555555
$traits = $tokens->getTraits();
556556
unset($tokens);
557557

558+
$link = $this->getId() . '.html#';
559+
558560
foreach ($traits as $traitName => $trait) {
559561
$this->traits[$traitName] = array(
560562
'methods' => array(),
@@ -564,7 +566,8 @@ protected function processTraits(PHP_Token_Stream $tokens)
564566
'ccn' => 0,
565567
'coverage' => 0,
566568
'crap' => 0,
567-
'package' => $trait['package']
569+
'package' => $trait['package'],
570+
'link' => $link . $trait['startLine']
568571
);
569572

570573
$this->startLines[$trait['startLine']] = &$this->traits[$traitName];
@@ -578,7 +581,8 @@ protected function processTraits(PHP_Token_Stream $tokens)
578581
'executedLines' => 0,
579582
'ccn' => $method['ccn'],
580583
'coverage' => 0,
581-
'crap' => 0
584+
'crap' => 0,
585+
'link' => $link . $method['startLine']
582586
);
583587

584588
$this->startLines[$method['startLine']] = &$this->traits[$traitName]['methods'][$methodName];
@@ -595,13 +599,16 @@ protected function processFunctions(PHP_Token_Stream $tokens)
595599
$functions = $tokens->getFunctions();
596600
unset($tokens);
597601

602+
$link = $this->getId() . '.html#';
603+
598604
foreach ($functions as $functionName => $function) {
599605
$this->functions[$functionName] = array(
600606
'signature' => $function['signature'],
601607
'startLine' => $function['startLine'],
602608
'executableLines' => 0,
603609
'executedLines' => 0,
604-
'ccn' => $function['ccn']
610+
'ccn' => $function['ccn'],
611+
'link' => $link . $function['startLine']
605612
);
606613

607614
$this->startLines[$function['startLine']] = &$this->functions[$functionName];

0 commit comments

Comments
 (0)