private function copyDetection(array $logItem, array &$fileHistory, GitRepository $git)
    {
        if ($logItem['criteria'] !== 'C') {
            return;
        }

        $fromLastCommit        = $this->commitCollection[$logItem['commit']]['parent'];
        $fromFileContent       = $this->getFileContent($fromLastCommit . ':' . $logItem['from'], $git);
        $fromFileContentLength = \strlen($fromFileContent);

        $toFileContent       = $this->getFileContent($logItem['commit'] . ':' . $logItem['to'], $git);
        $toFileContentLength = \strlen($toFileContent);

        if ($fromFileContentLength === $toFileContentLength) {
            $fileHistory[\md5($logItem['from'])] = $logItem['from'];

            return;
        }

        $tempFrom =
            $this->createTempFile($logItem['commit'] . ':' . $logItem['from'], $fromFileContent);
        $tempTo   = $this->createTempFile($logItem['commit'] . ':' . $logItem['to'], $toFileContent);

        $detector = new Detector(new DefaultStrategy());
        $result   = $detector->copyPasteDetection([$tempFrom, $tempTo], 5, 35);

        if (!$result->count()) {
            return;
        }

        $fileHistory[\md5($logItem['from'])] = $logItem['from'];
    }
private function copyDetection(array $logItem, array &$fileHistory, GitRepository $git)
    {
        if ($logItem['criteria'] !== 'C') {
            return;
        }

        $fromLastCommit        = $this->commitCollection[$logItem['commit']]['parent'];
        $fromFileContent       = $this->getFileContent($fromLastCommit . ':' . $logItem['from'], $git);
        $fromFileContentLength = \strlen($fromFileContent);

        $toFileContent       = $this->getFileContent($logItem['commit'] . ':' . $logItem['to'], $git);
        $toFileContentLength = \strlen($toFileContent);

        if ($fromFileContentLength === $toFileContentLength) {
            $fileHistory[\md5($logItem['from'])] = $logItem['from'];

            return;
        }

        $tempFrom =
            $this->createTempFile($logItem['commit'] . ':' . $logItem['from'], $fromFileContent);
        $tempTo   = $this->createTempFile($logItem['commit'] . ':' . $logItem['to'], $toFileContent);

        $detector = new Detector(new DefaultStrategy());
        $result   = $detector->copyPasteDetection([$tempFrom, $tempTo], 5, 35);

        if (!$result->count()) {
            return;
        }

        $fileHistory[\md5($logItem['from'])] = $logItem['from'];
    }
private function copyDetection ( array $ logItem , array & $ fileHistory , GitRepository $ git ) { if ( $ logItem [ 'criteria' ] !== 'C' ) { return ; } $ fromLastCommit = $ this -> commitCollection [ $ logItem [ 'commit' ] ] [ 'parent' ] ; $ fromFileContent = $ this -> getFileContent ( $ fromLastCommit . ':' . $ logItem [ 'from' ] , $ git ) ; $ fromFileContentLength = \ strlen ( $ fromFileContent ) ; $ toFileContent = $ this -> getFileContent ( $ logItem [ 'commit' ] . ':' . $ logItem [ 'to' ] , $ git ) ; $ toFileContentLength = \ strlen ( $ toFileContent ) ; if ( $ fromFileContentLength === $ toFileContentLength ) { $ fileHistory [ \ md5 ( $ logItem [ 'from' ] ) ] = $ logItem [ 'from' ] ; return ; } $ tempFrom = $ this -> createTempFile ( $ logItem [ 'commit' ] . ':' . $ logItem [ 'from' ] , $ fromFileContent ) ; $ tempTo = $ this -> createTempFile ( $ logItem [ 'commit' ] . ':' . $ logItem [ 'to' ] , $ toFileContent ) ; $ detector = new Detector ( new DefaultStrategy ( ) ) ; $ result = $ detector -> copyPasteDetection ( [ $ tempFrom , $ tempTo ] , 5 , 35 ) ; if ( ! $ result -> count ( ) ) { return ; } $ fileHistory [ \ md5 ( $ logItem [ 'from' ] ) ] = $ logItem [ 'from' ] ; }
Detected file follow by the copy criteria.

@param array         $logItem     The git log item.
@param array         $fileHistory The file history.
@param GitRepository $git         The git repository.

@return void
Detected file follow by the copy criteria .