Last active
August 29, 2015 14:16
-
-
Save gonzaloserrano/f7aaa84f69dbb80d701e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 = [ | |
["fd", "df"], | |
["fd", "fd"], | |
[null, "fd"], | |
["fd", null], | |
]; | |
$remoteTable = [ | |
["A", "new_column_2"], | |
[null, null], | |
["fd", "df"], | |
["fd", "fd"], | |
]; | |
$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); | |
$htmlDiffRender = new \coopy_DiffRender(); | |
$htmlDiffRender->usePrettyArrows(false); | |
$htmlDiffRender->render($tableDiffView); | |
echo $htmlDiffRender->html(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment