예제 #1
0
 private function getChanges($previousSnapshot, $newSnapshot)
 {
     $changes = Diff::compare($previousSnapshot->readNoTags(), $newSnapshot->readNoTags());
     $hasText = false;
     foreach ($changes as $key => $change) {
         if ($change[1] === Diff::UNMODIFIED) {
             unset($changes[$key]);
         } else {
             $hasText = !empty($change[0]) ? true : $hasText;
         }
     }
     return $hasText && !empty($changes) ? $changes : NULL;
 }
예제 #2
0
 private function diff($x, $y)
 {
     $html = "<style>\n    \t\t.diffInserted{\n    \t\t\tborder: 1px solid rgb(192,255,192);\n    \t\t\tbackground: rgb(224,255,224);\n    \t\t}\n    \t\t.diffDeleted{\n    \t\t\tborder: 1px solid rgb(255,192,192);\n    \t\t\tbackground: rgb(255,224,224);\n    \t\t}\n    \t</style>";
     return $html . Diff::toTable(Diff::compare($x, $y));
 }