@@ -162,6 +162,9 @@ public function __construct($name, PHP_CodeCoverage_Report_HTML_Node $parent = N
162162 $ this ->highlight = $ highlight ;
163163 $ this ->yui = $ yui ;
164164 $ this ->codeLines = $ this ->loadFile ($ path );
165+ $ this ->ignoredLines = PHP_CodeCoverage_Util::getLinesToBeIgnored (
166+ $ path
167+ );
165168
166169 $ this ->calculateStatistics ();
167170 }
@@ -261,22 +264,14 @@ public function render($target, $title, $charset = 'ISO-8859-1', $lowUpperBound
261264 );
262265 }
263266
264- $ i = 1 ;
265- $ lines = '' ;
266- $ ignore = FALSE ;
267+ $ i = 1 ;
268+ $ lines = '' ;
267269
268270 foreach ($ this ->codeLines as $ line ) {
269- if (strpos ($ line , '@codeCoverageIgnoreStart ' ) !== FALSE ) {
270- $ ignore = TRUE ;
271- }
272-
273- else if (strpos ($ line , '@codeCoverageIgnoreEnd ' ) !== FALSE ) {
274- $ ignore = FALSE ;
275- }
276-
277271 $ css = '' ;
278272
279- if (!$ ignore && isset ($ this ->executedLines [$ i ])) {
273+ if (!isset ($ this ->ignoredLines [$ i ]) &&
274+ isset ($ this ->executedLines [$ i ])) {
280275 $ count = '' ;
281276
282277 // Array: Line is executable and was executed.
@@ -517,8 +512,7 @@ protected function calculateStatistics()
517512 $ this ->processClasses ();
518513 $ this ->processFunctions ();
519514
520- $ ignoreStart = -1 ;
521- $ lineNumber = 1 ;
515+ $ lineNumber = 1 ;
522516
523517 foreach ($ this ->codeLines as $ line ) {
524518 if (isset ($ this ->startLines [$ lineNumber ])) {
@@ -533,16 +527,6 @@ protected function calculateStatistics()
533527 }
534528 }
535529
536- if (strpos ($ line , '@codeCoverageIgnore ' ) !== FALSE ) {
537- if (strpos ($ line , '@codeCoverageIgnoreStart ' ) !== FALSE ) {
538- $ ignoreStart = $ lineNumber ;
539- }
540-
541- else if (strpos ($ line , '@codeCoverageIgnoreEnd ' ) !== FALSE ) {
542- $ ignoreStart = -1 ;
543- }
544- }
545-
546530 if (isset ($ this ->executedLines [$ lineNumber ])) {
547531 // Array: Line is executable and was executed.
548532 if (is_array ($ this ->executedLines [$ lineNumber ])) {
@@ -572,7 +556,7 @@ protected function calculateStatistics()
572556
573557 $ this ->numExecutableLines ++;
574558
575- if ($ ignoreStart != - 1 && $ lineNumber > $ ignoreStart ) {
559+ if (isset ( $ this -> ignoredLines [ $ lineNumber ]) ) {
576560 if (isset ($ currentClass )) {
577561 $ currentClass ['executedLines ' ]++;
578562 }
0 commit comments