private function patchExtractor($path, $extractor, $wantedAuthors)
    {
        if (!($this->diff && $extractor instanceof PatchingExtractor)) {
            return false;
        }

        $original = \explode("\n", $extractor->getBuffer($path));
        $new      = \explode("\n", $extractor->getBuffer($path, $wantedAuthors));
        $diff     = new \Diff($original, $new);
        $patch    = $diff->render($this->diff);

        if (empty($patch)) {
            return false;
        }

        $patchFile = $path;

        foreach ($this->config->getIncludedPaths() as $prefix) {
            $prefixLength = \strlen($prefix);
            if (strpos($path, $prefix) === 0) {
                $patchFile = \substr($path, $prefixLength);

                if (strncmp($patchFile, '/', 1) === 0) {
                    $patchFile = \substr($patchFile, 1);
                }
                break;
            }
        }

        $this->patchSet[] =
            'diff ' . $patchFile . ' ' . $patchFile . "\n" .
            '--- ' . $patchFile . "\n" .
            '+++ ' . $patchFile . "\n" .
            $patch;

        return true;
    }
private function patchExtractor($path, $extractor, $wantedAuthors)
    {
        if (!($this->diff && $extractor instanceof PatchingExtractor)) {
            return false;
        }

        $original = \explode("\n", $extractor->getBuffer($path));
        $new      = \explode("\n", $extractor->getBuffer($path, $wantedAuthors));
        $diff     = new \Diff($original, $new);
        $patch    = $diff->render($this->diff);

        if (empty($patch)) {
            return false;
        }

        $patchFile = $path;

        foreach ($this->config->getIncludedPaths() as $prefix) {
            $prefixLength = \strlen($prefix);
            if (strpos($path, $prefix) === 0) {
                $patchFile = \substr($path, $prefixLength);

                if (strncmp($patchFile, '/', 1) === 0) {
                    $patchFile = \substr($patchFile, 1);
                }
                break;
            }
        }

        $this->patchSet[] =
            'diff ' . $patchFile . ' ' . $patchFile . "\n" .
            '--- ' . $patchFile . "\n" .
            '+++ ' . $patchFile . "\n" .
            $patch;

        return true;
    }
private function patchExtractor ( $ path , $ extractor , $ wantedAuthors ) { if ( ! ( $ this -> diff && $ extractor instanceof PatchingExtractor ) ) { return false ; } $ original = \ explode ( "\n" , $ extractor -> getBuffer ( $ path ) ) ; $ new = \ explode ( "\n" , $ extractor -> getBuffer ( $ path , $ wantedAuthors ) ) ; $ diff = new \ Diff ( $ original , $ new ) ; $ patch = $ diff -> render ( $ this -> diff ) ; if ( empty ( $ patch ) ) { return false ; } $ patchFile = $ path ; foreach ( $ this -> config -> getIncludedPaths ( ) as $ prefix ) { $ prefixLength = \ strlen ( $ prefix ) ; if ( strpos ( $ path , $ prefix ) === 0 ) { $ patchFile = \ substr ( $ path , $ prefixLength ) ; if ( strncmp ( $ patchFile , '/' , 1 ) === 0 ) { $ patchFile = \ substr ( $ patchFile , 1 ) ; } break ; } } $ this -> patchSet [ ] = 'diff ' . $ patchFile . ' ' . $ patchFile . "\n" . '--- ' . $ patchFile . "\n" . '+++ ' . $ patchFile . "\n" . $ patch ; return true ; }
Handle the patching cycle for a extractor.

@param string          $path          The path to patch.
@param AuthorExtractor $extractor     The extractor to patch.
@param array           $wantedAuthors The authors that shall be contained in the result.

@return bool True if the patch has been collected, false otherwise.
Handle the patching cycle for a extractor .