class _HWLDF_WordAccumulator in Diff 6
Same name and namespace in other branches
- 5.2 DiffEngine.php \_HWLDF_WordAccumulator
- 5 DiffEngine.php \_HWLDF_WordAccumulator
- 6.2 DiffEngine.php \_HWLDF_WordAccumulator
- 7.3 DiffEngine.php \_HWLDF_WordAccumulator
- 7.2 DiffEngine.php \_HWLDF_WordAccumulator
@todo document @private @subpackage DifferenceEngine
Hierarchy
- class \_HWLDF_WordAccumulator
Expanded class hierarchy of _HWLDF_WordAccumulator
File
- ./
DiffEngine.php, line 903
View source
class _HWLDF_WordAccumulator {
function _HWLDF_WordAccumulator() {
$this->_lines = array();
$this->_line = '';
$this->_group = '';
$this->_tag = '';
}
function _flushGroup($new_tag) {
if ($this->_group !== '') {
if ($this->_tag == 'mark') {
$this->_line .= '<span class="diffchange">' . check_plain($this->_group) . '</span>';
}
else {
$this->_line .= check_plain($this->_group);
}
}
$this->_group = '';
$this->_tag = $new_tag;
}
function _flushLine($new_tag) {
$this
->_flushGroup($new_tag);
if ($this->_line != '') {
array_push($this->_lines, $this->_line);
}
else {
# make empty lines visible by inserting an NBSP
array_push($this->_lines, NBSP);
}
$this->_line = '';
}
function addWords($words, $tag = '') {
if ($tag != $this->_tag) {
$this
->_flushGroup($tag);
}
foreach ($words as $word) {
// new-line should only come as first char of word.
if ($word == '') {
continue;
}
if ($word[0] == "\n") {
$this
->_flushLine($tag);
$word = substr($word, 1);
}
assert(!strstr($word, "\n"));
$this->_group .= $word;
}
}
function getLines() {
$this
->_flushLine('~done');
return $this->_lines;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
_HWLDF_WordAccumulator:: |
function | |||
_HWLDF_WordAccumulator:: |
function | |||
_HWLDF_WordAccumulator:: |
function | |||
_HWLDF_WordAccumulator:: |
function | |||
_HWLDF_WordAccumulator:: |
function |