MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

DiffLine

MMO\git\helpers · 1 symbole · générée le 27 Oct 2026

class

DiffLine

DiffLine.php:13

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\helpers
Implémente
JsonSerializable
foreach ($hunk->lines as $line) { if ($line->isAdded()) {echo "+{$line->new}: {$line->text}\n";} }

Index

ADDEDa line of the new side only
KEPTan unchanged line, on both sides
REMOVEDa line of the old side only
commit
new readonly
noNewline
old readonly
text readonly
type readonly
isAdded()
isKept()
isRemoved()
jsonSerialize()
__construct($type, $old, $new, $text, $noNewline, $commit)

Constantes3

ADDED

a line of the new side only

const ADDED = '+'

KEPT

an unchanged line, on both sides

const KEPT = ' '

REMOVED

a line of the old side only

const REMOVED = '-'

Propriétés6

new

readonly
readonly ?int $new
Type
null | int

noNewline

bool $noNewline
Type
bool

old

readonly
readonly ?int $old
Type
null | int

text

readonly
readonly string $text
Type
string

type

readonly
readonly string $type
Type
string

Méthodes5

jsonSerialize()

DiffLine.php:44
function jsonSerialize(): array
retournearraystring, old: ?int, new: ?int, text: string, noNewline?: true, commit?: string}

__construct($type, $old, $new, $text, $noNewline, $commit)

DiffLine.php:30
function __construct( string $type, ?int $old, ?int $new, string $text, bool $noNewline = false, ?string $commit = null )
$typestringKEPT, ADDED or REMOVED
$oldnull | intits number in the old file (1-based); null for an added line
$newnull | intits number in the new file (1-based); null for a removed line
$textstringthe line, without its end of line
$noNewline = falseboolthe last line of its file, which has no end of line (git's \ No newline at end of file)
$commit = nullnull | stringthe 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