Created
March 3, 2015 17:19
-
-
Save gonzaloserrano/d74bbbf452f745b91a0f to your computer and use it in GitHub Desktop.
daff-php broken diff
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 = [ | |
['col1', 'col2', 'col3', 'col4', 'col5'], | |
[0, 0, 0, 0, 0] | |
]; | |
$remoteTable = [ | |
['col1', 'col2', 'col3', 'col4', 'col5'], | |
['xxx', 0, 0, 0, 0] | |
]; | |
$localTableView = new \coopy_PhpTableView($localTable); | |
$remoteTableView = new \coopy_PhpTableView($remoteTable); | |
$compareView = \coopy_Coopy::compareTables($localTableView, $remoteTableView); | |
// compute aligment | |
$alignment = $compareView->align(); | |
// produce the diff | |
$tableDiffData = []; | |
$tableDiffView = new \coopy_PhpTableView($tableDiffData); | |
$flags = new \coopy_CompareFlags(); | |
$flags->always_show_order = true; | |
$flags->never_show_order = false; | |
$highlighter = new \coopy_TableDiff($alignment, $flags); | |
$highlighter->hilite($tableDiffView); | |
print_r($tableDiffView->getData()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment