@@ -92,7 +92,9 @@ protected function renderItems(PHP_CodeCoverage_Report_Node_File $node)
9292 $ template = new Text_Template ($ this ->templatePath . 'file_item.html ' , '{{ ' , '}} ' );
9393
9494 $ methodItemTemplate = new Text_Template (
95- $ this ->templatePath . 'method_item.html ' , '{{ ' , '}} '
95+ $ this ->templatePath . 'method_item.html ' ,
96+ '{{ ' ,
97+ '}} '
9698 );
9799
98100 $ items = $ this ->renderItemTemplate (
@@ -168,44 +170,46 @@ protected function renderTraitOrClassItems(array $items, Text_Template $template
168170 'numMethods ' => $ numMethods ,
169171 'numTestedMethods ' => $ numTestedMethods ,
170172 'linesExecutedPercent ' => PHP_CodeCoverage_Util::percent (
171- $ item ['executedLines ' ],
172- $ item ['executableLines ' ],
173- false
174- ),
173+ $ item ['executedLines ' ],
174+ $ item ['executableLines ' ],
175+ false
176+ ),
175177 'linesExecutedPercentAsString ' => PHP_CodeCoverage_Util::percent (
176- $ item ['executedLines ' ],
177- $ item ['executableLines ' ],
178- true
179- ),
178+ $ item ['executedLines ' ],
179+ $ item ['executableLines ' ],
180+ true
181+ ),
180182 'numExecutedLines ' => $ item ['executedLines ' ],
181183 'numExecutableLines ' => $ item ['executableLines ' ],
182184 'testedMethodsPercent ' => PHP_CodeCoverage_Util::percent (
183- $ numTestedMethods ,
184- $ numMethods ,
185- false
186- ),
185+ $ numTestedMethods ,
186+ $ numMethods ,
187+ false
188+ ),
187189 'testedMethodsPercentAsString ' => PHP_CodeCoverage_Util::percent (
188- $ numTestedMethods ,
189- $ numMethods ,
190- true
191- ),
190+ $ numTestedMethods ,
191+ $ numMethods ,
192+ true
193+ ),
192194 'testedClassesPercent ' => PHP_CodeCoverage_Util::percent (
193- $ numTestedMethods == $ numMethods ? 1 : 0 ,
194- 1 ,
195- false
196- ),
195+ $ numTestedMethods == $ numMethods ? 1 : 0 ,
196+ 1 ,
197+ false
198+ ),
197199 'testedClassesPercentAsString ' => PHP_CodeCoverage_Util::percent (
198- $ numTestedMethods == $ numMethods ? 1 : 0 ,
199- 1 ,
200- true
201- ),
200+ $ numTestedMethods == $ numMethods ? 1 : 0 ,
201+ 1 ,
202+ true
203+ ),
202204 'crap ' => $ item ['crap ' ]
203205 )
204206 );
205207
206208 foreach ($ item ['methods ' ] as $ method ) {
207209 $ buffer .= $ this ->renderFunctionOrMethodItem (
208- $ methodItemTemplate , $ method , ' '
210+ $ methodItemTemplate ,
211+ $ method ,
212+ ' '
209213 );
210214 }
211215 }
@@ -228,7 +232,8 @@ protected function renderFunctionItems(array $functions, Text_Template $template
228232
229233 foreach ($ functions as $ function ) {
230234 $ buffer .= $ this ->renderFunctionOrMethodItem (
231- $ template , $ function
235+ $ template ,
236+ $ function
232237 );
233238 }
234239
@@ -255,27 +260,27 @@ protected function renderFunctionOrMethodItem(Text_Template $template, array $it
255260 'numMethods ' => 1 ,
256261 'numTestedMethods ' => $ numTestedItems ,
257262 'linesExecutedPercent ' => PHP_CodeCoverage_Util::percent (
258- $ item ['executedLines ' ],
259- $ item ['executableLines ' ],
260- false
261- ),
263+ $ item ['executedLines ' ],
264+ $ item ['executableLines ' ],
265+ false
266+ ),
262267 'linesExecutedPercentAsString ' => PHP_CodeCoverage_Util::percent (
263- $ item ['executedLines ' ],
264- $ item ['executableLines ' ],
265- true
266- ),
268+ $ item ['executedLines ' ],
269+ $ item ['executableLines ' ],
270+ true
271+ ),
267272 'numExecutedLines ' => $ item ['executedLines ' ],
268273 'numExecutableLines ' => $ item ['executableLines ' ],
269274 'testedMethodsPercent ' => PHP_CodeCoverage_Util::percent (
270- $ numTestedItems ,
271- 1 ,
272- false
273- ),
275+ $ numTestedItems ,
276+ 1 ,
277+ false
278+ ),
274279 'testedMethodsPercentAsString ' => PHP_CodeCoverage_Util::percent (
275- $ numTestedItems ,
276- 1 ,
277- true
278- ),
280+ $ numTestedItems ,
281+ 1 ,
282+ true
283+ ),
279284 'crap ' => $ item ['crap ' ]
280285 )
281286 );
@@ -319,40 +324,34 @@ protected function renderSource(PHP_CodeCoverage_Report_Node_File $node)
319324 foreach ($ coverageData [$ i ] as $ test ) {
320325 if ($ testData [$ test ]['size ' ] == 'medium ' ) {
321326 $ lineCss = 'covered-by-medium-tests ' ;
322- } else if ($ testData [$ test ]['size ' ] == 'small ' ) {
327+ } elseif ($ testData [$ test ]['size ' ] == 'small ' ) {
323328 $ lineCss = 'covered-by-small-tests ' ;
324329 }
325330
326331 switch ($ testData [$ test ]['status ' ]) {
327- case 0 : {
332+ case 0 :
328333 $ testCSS = ' class="success" ' ;
329- }
330334 break ;
331335
332336 case 1 :
333- case 2 : {
337+ case 2 :
334338 $ testCSS = ' class="warning" ' ;
335- }
336339 break ;
337340
338- case 3 : {
341+ case 3 :
339342 $ testCSS = ' class="danger" ' ;
340- }
341343 break ;
342344
343- case 4 : {
345+ case 4 :
344346 $ testCSS = ' class="danger" ' ;
345- }
346347 break ;
347348
348- default : {
349- $ testCSS = '' ;
350- }
349+ default :
350+ $ testCSS = '' ;
351351 }
352352
353353 $ popoverContent .= sprintf (
354354 '<li%s>%s</li> ' ,
355-
356355 $ testCSS ,
357356 htmlspecialchars ($ test )
358357 );
@@ -409,15 +408,13 @@ protected function loadFile($file)
409408 if ($ token === '" ' && $ tokens [$ j - 1 ] !== '\\' ) {
410409 $ result [$ i ] .= sprintf (
411410 '<span class="string">%s</span> ' ,
412-
413411 htmlspecialchars ($ token )
414412 );
415413
416414 $ stringFlag = !$ stringFlag ;
417415 } else {
418416 $ result [$ i ] .= sprintf (
419417 '<span class="keyword">%s</span> ' ,
420-
421418 htmlspecialchars ($ token )
422419 );
423420 }
@@ -446,15 +443,13 @@ protected function loadFile($file)
446443 $ colour = 'string ' ;
447444 } else {
448445 switch ($ token ) {
449- case T_INLINE_HTML : {
446+ case T_INLINE_HTML :
450447 $ colour = 'html ' ;
451- }
452448 break ;
453449
454450 case T_COMMENT :
455- case T_DOC_COMMENT : {
451+ case T_DOC_COMMENT :
456452 $ colour = 'comment ' ;
457- }
458453 break ;
459454
460455 case T_ABSTRACT :
@@ -512,20 +507,17 @@ protected function loadFile($file)
512507 case T_USE :
513508 case T_VAR :
514509 case T_WHILE :
515- case T_YIELD : {
510+ case T_YIELD :
516511 $ colour = 'keyword ' ;
517- }
518512 break ;
519513
520- default : {
521- $ colour = 'default ' ;
522- }
514+ default :
515+ $ colour = 'default ' ;
523516 }
524517 }
525518
526519 $ result [$ i ] .= sprintf (
527520 '<span class="%s">%s</span> ' ,
528-
529521 $ colour ,
530522 $ line
531523 );
0 commit comments