You are here

function DiffFormatter::_block in Diff 6

Same name and namespace in other branches
  1. 5.2 DiffEngine.php \DiffFormatter::_block()
  2. 5 DiffEngine.php \DiffFormatter::_block()
  3. 6.2 DiffEngine.php \DiffFormatter::_block()
  4. 7.3 DiffEngine.php \DiffFormatter::_block()
  5. 7.2 DiffEngine.php \DiffFormatter::_block()
1 call to DiffFormatter::_block()
DiffFormatter::format in ./DiffEngine.php
* Format a diff. * *

File

./DiffEngine.php, line 823

Class

DiffFormatter
A class to format Diffs

Code

function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) {
  $this
    ->_start_block($this
    ->_block_header($xbeg, $xlen, $ybeg, $ylen));
  foreach ($edits as $edit) {
    if ($edit->type == 'copy') {
      $this
        ->_context($edit->orig);
    }
    elseif ($edit->type == 'add') {
      $this
        ->_added($edit->closing);
    }
    elseif ($edit->type == 'delete') {
      $this
        ->_deleted($edit->orig);
    }
    elseif ($edit->type == 'change') {
      $this
        ->_changed($edit->orig, $edit->closing);
    }
    else {
      trigger_error('Unknown edit type', E_USER_ERROR);
    }
  }
  $this
    ->_end_block();
}