Text_Diff::countAddedLines()publicWP 1.1.0

returns the number of new (added) lines in a given diff.

Method of the class: Text_Diff{}

No Hooks.

Return

Int. The number of new lines

Usage

$Text_Diff = new Text_Diff();
$Text_Diff->countAddedLines();

Changelog

Since 1.1.0 Introduced.
Since Text_Diff 1.1.0

Text_Diff::countAddedLines() code WP 6.1.1

function countAddedLines()
{
    $count = 0;
    foreach ($this->_edits as $edit) {
        if (is_a($edit, 'Text_Diff_Op_add') ||
            is_a($edit, 'Text_Diff_Op_change')) {
            $count += $edit->nfinal();
        }
    }
    return $count;
}