fwrite($fp,
implode("\n",
$from_lines));
fclose($fp);
$fp =
fopen($to_file, 'w'
);
fwrite($fp,
implode("\n",
$to_lines));
fclose($fp);
$diff =
shell_exec($this->_diffCommand . ' ' .
$from_file . ' ' .
$to_file);
unlink($from_file);
unlink($to_file);
if (is_null($diff)) { // No changes were made
return array
(new Text_Diff_Op_copy($from_lines));
} $from_line_no = 1;
$to_line_no = 1;
$edits = array
();
// Get changed lines by parsing something like:
// 0a1,2
// 1,2c4,6
// 1,5d6
preg_match_all('#^(\d+)(?:,(\d+))?([adc])(\d+)(?:,(\d+))?$#m',
$diff,