Ejemplo n.º 1
0
 /**
  * Tell the module to init info about itself.
  *
  * Check it's still valid-ish and has files and an info file.
  * The dir may have gone away in the meantime.
  *
  * @param $module
  *
  * @return Module
  */
 public function runContentScan(Module $module)
 {
     if (!is_dir($module->getLocation())) {
         error_log('Module Directory has gome missing.');
         $module->addStatus('content:failed-missing');
     } else {
         $filecount = $module->getFilecount();
         $this->log("{$module->name} filecount is {$filecount}");
         $codefilecount = $module->getCodeFilecount($this->options['extensions']);
         $this->log("{$module->name} codefilecount is {$codefilecount}");
         $module->addStatus('content:processed');
     }
     return $module;
 }
Ejemplo n.º 2
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;
 }