Text_Diff::countAddedLines()publicWP 1.1.0

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

Метод класса: Text_Diff{}

Хуков нет.

Возвращает

int. The number of new lines

Использование

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

Список изменений

С версии 1.1.0 Введена.
Since Text_Diff 1.1.0

Код Text_Diff::countAddedLines() WP 6.6.2

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;
}