SebastianBergmann\PHPCPD\Detector\Detector::copyPasteDetection PHP Method

copyPasteDetection() public method

Copy & Paste Detection (CPD).
public copyPasteDetection ( Iterator | array $files, integer $minLines = 5, integer $minTokens = 70, boolean $fuzzy = false ) : CodeCloneMap
$files Iterator | array List of files to process
$minLines integer Minimum number of identical lines
$minTokens integer Minimum number of identical tokens
$fuzzy boolean
return SebastianBergmann\PHPCPD\CodeCloneMap Map of exact clones found in the list of files
    public function copyPasteDetection($files, $minLines = 5, $minTokens = 70, $fuzzy = false)
    {
        $result = new CodeCloneMap();
        foreach ($files as $file) {
            $this->strategy->processFile($file, $minLines, $minTokens, $result, $fuzzy);
            if ($this->progressBar !== null) {
                $this->progressBar->advance();
            }
        }
        return $result;
    }

Usage Example

Esempio n. 1
0
File: Cpd.php Progetto: horde/horde
 /**
  * Run the task.
  *
  * @param array &$options Additional options.
  *
  * @return integer Number of errors.
  */
 public function run(&$options)
 {
     $finder = new FinderFacade(array(realpath($this->_config->getPath() . '/lib')));
     $files = $finder->findFiles();
     $detector = new PHPCPD\Detector\Detector(new PHPCPD\Detector\Strategy\DefaultStrategy());
     $clones = $detector->copyPasteDetection($files, 5, 70);
     $this->_printResult($clones);
     return count($clones);
 }
All Usage Examples Of SebastianBergmann\PHPCPD\Detector\Detector::copyPasteDetection