Documentations › mmo.git › php › helpers DiffLine MMO\git\helpers · 1 symbole · générée le 27 Oct 2026
One line of a DiffHunk : kept, added or removed, with its number on each side it exists on.
class MMO\git\helpers\DiffLine
implements JsonSerializable Espace de noms MMO\git\helpersImplémente JsonSerializable foreach ($hunk->lines as $line) {
if ($line->isAdded()) {echo "+{$line->new}: {$line->text}\n";}
}
Constantes3 a line of the new side only
const ADDED = '+' an unchanged line, on both sides
const KEPT = ' ' a line of the old side only
const REMOVED = '-' Méthodes5 function isAdded(): bool function isKept(): bool function isRemoved(): bool function jsonSerialize(): array retourne array string, old: ?int, new: ?int, text: string, noNewline?: true, commit?: string}
function __construct(
string $type,
?int $old,
?int $new,
string $text,
bool $noNewline = false,
?string $commit = null
) $type string KEPT , ADDED or REMOVED$old null | int its number in the old file (1-based); null for an added line $new null | int its number in the new file (1-based); null for a removed line $text string the line, without its end of line $noNewline = false bool the last line of its file, which has no end of line (git's \ No newline at end of file) $commit = null null | string the commit of the range that made this change (Repository::attribute ): wrote the added line, removed the removed one; null: not attributed, or older than the range