SebastianBergmann\Git\Git::getDiff PHP Method

getDiff() public method

public getDiff ( string $from, string $to ) : string
$from string
$to string
return string
    public function getDiff($from, $to)
    {
        $output = $this->execute('diff --no-ext-diff ' . $from . ' ' . $to);
        return implode("\n", $output);
    }

Usage Example

Example #1
0
 private function getReporter()
 {
     if ($this->diff) {
         list($commitA, $commitB) = explode('...', $this->diff, 2);
         $git = new Git(getcwd());
         $diffParser = new Parser();
         $diff = $diffParser->parse($git->getDiff($commitA, $commitB));
         return new Reporter\DiffFilter($this->getContainer()->get('reporter'), $diff);
     }
     return $this->getContainer()->get('reporter');
 }