Example #1
0
 private function showDiff(Document $document, $existingFilepath)
 {
     $before = file_get_contents($existingFilepath);
     $after = $document->getContent();
     $diff = Diff\Diff::create($before, $after);
     $this->stdio->out('Differences to existing file:');
     if (!count($diff->getDiffLines())) {
         $this->stdio->outln(' <<yellow>>None<<reset>>');
         $this->stdio->outln();
         return;
     }
     $this->stdio->outln();
     $this->stdio->outln();
     if ($this->stdio->getStdout()->isPosix()) {
         $t = new Diff\Format\Template\POSIX();
     } else {
         $t = new Diff\Format\Template\Text();
     }
     $this->stdio->outln($t->format($diff));
     $this->stdio->outln();
 }