コード例 #1
0
 /**
  * Runs PHP LinesOfCode analysis.
  *
  * Https://github.com/sebastianbergmann/phploc.
  *
  * @param \DrupalCodeMetrics\Module $module
  * @param $extensions
  * @return array|null
  */
 function getLocAnalysis(Module $module, $extensions)
 {
     // Run phploc analyser directly as PHP.
     $analyser = new Analyser();
     // It's my job to set the parameters right, and take care to only give it
     // PHP files (it borks on binaries, understandably).
     $tree = $module->getCodeFiles($extensions);
     $analysis = NULL;
     try {
         $analysis = $analyser->countFiles($tree, TRUE);
     } catch (Exception $e) {
         $message = "When processing " . $module->getLocation() . " " . $e->getMessage();
         error_log($message);
     }
     return $analysis;
 }