1.20.x diff.inc protected DiffFormatter::block($xbeg, $xlen, $ybeg, $ylen, &$edits)

Parameters

int $xbeg:

int $xlen:

int $ybeg:

int $ylen:

$edits:

Throws

Exception

File

includes/diff.inc, line 1098
A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)

Class

DiffFormatter
Base class for diff formatters

Code

protected function block($xbeg, $xlen, $ybeg, $ylen, &$edits) {
  $this->startBlock($this->blockHeader($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 {
      throw new Exception("Unknown edit type: {$edit->type}");
    }
  }
  $this->endBlock();
}