コード例 #1
0
ファイル: Detector.php プロジェクト: hpbuniat/phpcpd
 /**
  * Copy & Paste Detection (CPD).
  *
  * @param  Iterator|array   $files     List of files to process
  * @param  integer          $minLines  Minimum number of identical lines
  * @param  integer          $minTokens Minimum number of identical tokens
  */
 public function copyPasteDetection($files, $minLines = 5, $minTokens = 70)
 {
     $oMap = new PHPCPD_CloneMap();
     if ($this->output !== NULL) {
         $bar = new ezcConsoleProgressbar($this->output, count($files));
         print 'Processing files' . PHP_EOL;
     }
     $this->strategy->init($oMap, $minLines, $minTokens);
     $oTokenizer = new PHPCPD_Detector_Tokenizer();
     foreach ($files as $file) {
         $oTokenizer->process($this->strategy, $oMap, $file);
         if ($this->output !== NULL) {
             $bar->advance();
         }
     }
     if ($this->output !== NULL) {
         print PHP_EOL . PHP_EOL;
     }
     return $oMap;
 }