_leading_context_lines = $context_lines; $this->_trailing_context_lines = $context_lines; $this->_table = []; } protected function _startDiff() { } protected function _endDiff() { return $this->_table; } protected function _blockHeader($xbeg, $xlen, $ybeg, $ylen) { if ($xlen != 1) { $l = $xbeg + $xlen - 1; $xbeg .= '-' . $l; } if ($ylen != 1) { $l = $ybeg + $ylen - 1; $ybeg .= '-' . $l; } $this->_table[] = ['type' => "diffheader", 'old' => "$xbeg", 'new' => "$ybeg"]; } protected function _context($lines) { $this->_table[] = ['type' => "diffbody", 'data' => $lines]; } protected function _added($lines) { $this->_table[] = ['type' => "diffadded", 'data' => $lines]; } protected function _deleted($lines) { $this->_table[] = ['type' => "diffdeleted", 'data' => $lines]; } protected function _changed($orig, $final) { $lines = diffChar($orig, $final, 0); $this->_deleted([$lines[0]]); $this->_added([$lines[1]]); } }