Last active
August 29, 2015 14:24
-
-
Save sp-ruben-simon/f049beb378851bdfba80 to your computer and use it in GitHub Desktop.
daff-php patch error when remove a duplicate row
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
$localTable = [ | |
['A', 'B'], | |
[2, 2], | |
[2, 2], | |
[3, 8] | |
]; | |
$remoteTable = [ | |
['A', 'B'], | |
[2, 2], | |
[3, 8] | |
]; | |
$localTableView = new \coopy_PhpTableView($localTable); | |
$remoteTableView = new \coopy_PhpTableView($remoteTable); | |
$compareView = \coopy_Coopy::compareTables($localTableView, $remoteTableView); | |
$alignment = $compareView->align(); | |
// produce the diff | |
$tableDiffData = []; | |
$tableDiffView = new \coopy_PhpTableView($tableDiffData); | |
$flags = new \coopy_CompareFlags(); | |
$highlighter = new \coopy_TableDiff($alignment, $flags); | |
$highlighter->hilite($tableDiffView); | |
print_r("Diff Table"); | |
print_r($tableDiffView->getData()); | |
$patch = new coopy_HighlightPatch( | |
$localTableView, | |
$tableDiffView | |
); | |
$patch->apply(); | |
$patchedData = $localTableView->getData(); | |
print_r("Patched Table"); | |
print_r($patchedData); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment