ILIAS  release_4-4 Revision
DiffFormatter Class Reference
+ Inheritance diagram for DiffFormatter:
+ Collaboration diagram for DiffFormatter:

Public Member Functions

 format ($diff)
 Format a diff. More...
 
 _block ($xbeg, $xlen, $ybeg, $ylen, &$edits)
 
 _start_diff ()
 
 _end_diff ()
 
 _block_header ($xbeg, $xlen, $ybeg, $ylen)
 
 _start_block ($header)
 
 _end_block ()
 
 _lines ($lines, $prefix=' ')
 
 _context ($lines)
 
 _added ($lines)
 
 _deleted ($lines)
 
 _changed ($orig, $closing)
 

Data Fields

 $leading_context_lines = 0
 Number of leading context "lines" to preserve. More...
 
 $trailing_context_lines = 0
 Number of trailing context "lines" to preserve. More...
 

Detailed Description

Definition at line 1391 of file class.WordLevelDiff.php.

Member Function Documentation

◆ _added()

DiffFormatter::_added (   $lines)

Definition at line 1530 of file class.WordLevelDiff.php.

1532  {

◆ _block()

DiffFormatter::_block (   $xbeg,
  $xlen,
  $ybeg,
  $ylen,
$edits 
)

Definition at line 1475 of file class.WordLevelDiff.php.

1489  {
1490  $fname = 'DiffFormatter::_block';
1491  //wfProfileIn( $fname );
1492  $this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen));
1493  foreach ($edits as $edit) {
_block_header($xbeg, $xlen, $ybeg, $ylen)

◆ _block_header()

DiffFormatter::_block_header (   $xbeg,
  $xlen,
  $ybeg,
  $ylen 
)

Definition at line 1505 of file class.WordLevelDiff.php.

1509  {
1510  ob_start();
1511  }
1512 

◆ _changed()

DiffFormatter::_changed (   $orig,
  $closing 
)

Definition at line 1537 of file class.WordLevelDiff.php.

1540  {
1541  $this->_lines($lines);
_lines($lines, $prefix=' ')

◆ _context()

DiffFormatter::_context (   $lines)

Definition at line 1526 of file class.WordLevelDiff.php.

1528  {

◆ _deleted()

DiffFormatter::_deleted (   $lines)

Definition at line 1533 of file class.WordLevelDiff.php.

1535  {

◆ _end_block()

DiffFormatter::_end_block ( )

Definition at line 1518 of file class.WordLevelDiff.php.

1519  {

◆ _end_diff()

DiffFormatter::_end_diff ( )

Definition at line 1499 of file class.WordLevelDiff.php.

1509  {

◆ _lines()

DiffFormatter::_lines (   $lines,
  $prefix = ' ' 
)

Definition at line 1521 of file class.WordLevelDiff.php.

1525  : 'd') : 'a') . $ybeg;

◆ _start_block()

DiffFormatter::_start_block (   $header)

Definition at line 1514 of file class.WordLevelDiff.php.

1519  {

◆ _start_diff()

DiffFormatter::_start_diff ( )

Definition at line 1495 of file class.WordLevelDiff.php.

1509  {

◆ format()

DiffFormatter::format (   $diff)

Format a diff.

Parameters
$diffobject A Diff object.
Returns
string The formatted output.

Definition at line 1415 of file class.WordLevelDiff.php.

1429  {
1430  $fname = 'DiffFormatter::format';
1431  //wfProfileIn( $fname );
1432 
1433  $xi = $yi = 1;
1434  $block = false;
1435  $context = array();
1436 
1439 
1440  $this->_start_diff();
1441 
1442  foreach ($diff->edits as $edit) {
1443  if ($edit->type == 'copy') {
1444  if (is_array($block)) {
1445  if (sizeof($edit->orig) <= $nlead + $ntrail) {
1446  $block[] = $edit;
1447  }
1448  else{
1449  if ($ntrail) {
1450  $context = array_slice($edit->orig, 0, $ntrail);
1451  $block[] = new _DiffOp_Copy($context);
1452  }
1453  $this->_block($x0, $ntrail + $xi - $x0,
1454  $y0, $ntrail + $yi - $y0,
1455  $block);
1456  $block = false;
1457  }
1458  }
1459  $context = $edit->orig;
1460  }
1461  else {
1462  if (! is_array($block)) {
1463  $context = array_slice($context, sizeof($context) - $nlead);
1464  $x0 = $xi - sizeof($context);
1465  $y0 = $yi - sizeof($context);
1466  $block = array();
1467  if ($context)
1468  $block[] = new _DiffOp_Copy($context);
1469  }
1470  $block[] = $edit;
1471  }
1472 
1473  if ($edit->orig)
$leading_context_lines
Number of leading context "lines" to preserve.
_block($xbeg, $xlen, $ybeg, $ylen, &$edits)
$trailing_context_lines
Number of trailing context "lines" to preserve.

Field Documentation

◆ $leading_context_lines

DiffFormatter::$leading_context_lines = 0

Number of leading context "lines" to preserve.

This should be left at zero for this class, but subclasses may want to set this to other values.

Definition at line 1399 of file class.WordLevelDiff.php.

◆ $trailing_context_lines

DiffFormatter::$trailing_context_lines = 0

Number of trailing context "lines" to preserve.

This should be left at zero for this class, but subclasses may want to set this to other values.

Definition at line 1407 of file class.WordLevelDiff.php.


The documentation for this class was generated from the following file: