@@ -558,18 +558,7 @@ protected function processClasses(PHP_Token_Stream $tokens)
558558 $ this ->endLines [$ class ['endLine ' ]] = &$ this ->classes [$ className ];
559559
560560 foreach ($ class ['methods ' ] as $ methodName => $ method ) {
561- $ this ->classes [$ className ]['methods ' ][$ methodName ] = [
562- 'methodName ' => $ methodName ,
563- 'signature ' => $ method ['signature ' ],
564- 'startLine ' => $ method ['startLine ' ],
565- 'endLine ' => $ method ['endLine ' ],
566- 'executableLines ' => 0 ,
567- 'executedLines ' => 0 ,
568- 'ccn ' => $ method ['ccn ' ],
569- 'coverage ' => 0 ,
570- 'crap ' => 0 ,
571- 'link ' => $ link . $ method ['startLine ' ]
572- ];
561+ $ this ->classes [$ className ]['methods ' ][$ methodName ] = $ this ->newMethod ($ methodName , $ method , $ link );
573562
574563 $ this ->startLines [$ method ['startLine ' ]] = &$ this ->classes [$ className ]['methods ' ][$ methodName ];
575564 $ this ->endLines [$ method ['endLine ' ]] = &$ this ->classes [$ className ]['methods ' ][$ methodName ];
@@ -605,18 +594,7 @@ protected function processTraits(PHP_Token_Stream $tokens)
605594 $ this ->endLines [$ trait ['endLine ' ]] = &$ this ->traits [$ traitName ];
606595
607596 foreach ($ trait ['methods ' ] as $ methodName => $ method ) {
608- $ this ->traits [$ traitName ]['methods ' ][$ methodName ] = [
609- 'methodName ' => $ methodName ,
610- 'signature ' => $ method ['signature ' ],
611- 'startLine ' => $ method ['startLine ' ],
612- 'endLine ' => $ method ['endLine ' ],
613- 'executableLines ' => 0 ,
614- 'executedLines ' => 0 ,
615- 'ccn ' => $ method ['ccn ' ],
616- 'coverage ' => 0 ,
617- 'crap ' => 0 ,
618- 'link ' => $ link . $ method ['startLine ' ]
619- ];
597+ $ this ->traits [$ traitName ]['methods ' ][$ methodName ] = $ this ->newMethod ($ methodName , $ method , $ link );
620598
621599 $ this ->startLines [$ method ['startLine ' ]] = &$ this ->traits [$ traitName ]['methods ' ][$ methodName ];
622600 $ this ->endLines [$ method ['endLine ' ]] = &$ this ->traits [$ traitName ]['methods ' ][$ methodName ];
@@ -676,4 +654,27 @@ protected function crap($ccn, $coverage)
676654 pow ($ ccn , 2 ) * pow (1 - $ coverage /100 , 3 ) + $ ccn
677655 );
678656 }
657+
658+ /**
659+ * @param string $methodName
660+ * @param array $method
661+ * @param string $link
662+ *
663+ * @return array
664+ */
665+ private function newMethod ($ methodName , array $ method , $ link )
666+ {
667+ return [
668+ 'methodName ' => $ methodName ,
669+ 'signature ' => $ method ['signature ' ],
670+ 'startLine ' => $ method ['startLine ' ],
671+ 'endLine ' => $ method ['endLine ' ],
672+ 'executableLines ' => 0 ,
673+ 'executedLines ' => 0 ,
674+ 'ccn ' => $ method ['ccn ' ],
675+ 'coverage ' => 0 ,
676+ 'crap ' => 0 ,
677+ 'link ' => $ link . $ method ['startLine ' ]
678+ ];
679+ }
679680}
0 commit comments