37 if (isset($this->$v)) {
51 foreach (get_object_vars($this) as $k => $v) {
78 foreach (
$diff->getDiff() as $edit) {
80 if (is_array($block)) {
81 if (count($edit->orig) <= $nlead + $ntrail) {
85 $context = array_slice($edit->orig, 0, $ntrail);
86 $block[] =
new Text_Diff_Op_copy($context);
88 $output .= $this->
_block($x0, $ntrail + $xi - $x0,
89 $y0, $ntrail + $yi - $y0,
94 $context = $edit->orig;
96 if (!is_array($block)) {
97 $context = array_slice($context, count($context) - $nlead);
98 $x0 = $xi - count($context);
99 $y0 = $yi - count($context);
102 $block[] =
new Text_Diff_Op_copy($context);
109 $xi += count($edit->orig);
112 $yi += count($edit->final);
116 if (is_array($block)) {
117 $output .= $this->
_block($x0, $xi - $x0,
125 function _block($xbeg, $xlen, $ybeg, $ylen, &$edits)
129 foreach ($edits as $edit) {
130 switch (strtolower(get_class($edit))) {
131 case 'text_diff_op_copy':
132 $output .= $this->
_context($edit->orig);
135 case 'text_diff_op_add':
136 $output .= $this->
_added($edit->final);
139 case 'text_diff_op_delete':
140 $output .= $this->
_deleted($edit->orig);
143 case 'text_diff_op_change':
144 $output .= $this->
_changed($edit->orig, $edit->final);
165 $xbeg .=
',' . ($xbeg + $xlen - 1);
168 $ybeg .=
',' . ($ybeg + $ylen - 1);
171 return $xbeg . ($xlen ? ($ylen ?
'c' :
'd') :
'a') . $ybeg;
176 return $header .
"\n";
186 return $prefix . implode(
"\n$prefix", $lines) .
"\n";
191 return $this->
_lines($lines);
196 return $this->
_lines($lines,
'>');
201 return $this->
_lines($lines,
'<');