_addBytes = 0; $this->_delBytes = 0; $this->_first = $first; } protected function _startDiff() { } protected function _endDiff() { return 'add=' . $this->_addBytes . '&del=' . $this->_delBytes; } protected function _blockHeader($xbeg, $xlen, $ybeg, $ylen) { } protected function _added($lines) { $this->_addBytes += $this->_count($lines); } protected function _deleted($lines) { $this->_delBytes += $this->_count($lines); } protected function _changed($orig, $final) { if ($this->_first >= 0) { // stop recursion $this->_addBytes += count($final); $this->_delBytes += count($orig); return; } $change = diffChar($orig, $final, 0, 'bytes'); preg_match("/add=([0-9]*)&del=([0-9]*)/", $change, $matches); $this->_addBytes += $matches[1]; $this->_delBytes += $matches[2]; } protected function _count($lines) { $bytes = 0; foreach ($lines as $line) { $bytes += strlen($line); } return $bytes; } }