FileDiff

Class
Read only: Yes Final: Yes

Carries the result of comparing source and target file contents.

Table of Contents

Constants

 = 'binary'
 = 'changed'
 = 'unchanged'
 = 'unreadable'

Properties

 : string|null
 : string
 : string

Methods

__construct()

Creates a new file diff result.

 : mixed
getDiff()

Returns the optional unified diff payload.

 : string|null
getStatus()

Returns the comparison status.

 : string
getSummary()

Returns the human-readable summary.

 : string
isChanged()

Reports whether the compared files produced a text diff.

 : bool
isUnchanged()

Reports whether the compared files already match.

 : bool
Constants

Constants

STATUS_BINARY

Public
public string STATUS_BINARY = 'binary'

Description

indicates that a text diff should not be rendered for the compared files

STATUS_CHANGED

Public
public string STATUS_CHANGED = 'changed'

Description

indicates that the source and target differ and a text diff is available

STATUS_UNCHANGED

Public
public string STATUS_UNCHANGED = 'unchanged'

Description

indicates that the source and target already match

STATUS_UNREADABLE

Public
public string STATUS_UNREADABLE = 'unreadable'

Description

indicates that the compared files could not be read safely

Properties

$diff

Private
private string|null $diff = null

$status

Private
private string $status

$summary

Private
private string $summary
Methods

__construct()

Public

Creates a new file diff result.

public __construct( string  $status, string  $summary[, string|null  $diff = null]) : mixed
Parameters
$status : string

Description

the comparison status for the source and target files

$summary : string

Description

the human-readable summary for console output

$diff : string|null = null

Description

the optional unified diff payload

getDiff()

Public

Returns the optional unified diff payload.

public getDiff() : string|null
Return values
string|null

Description

the diff payload, or null when no text diff is available

getStatus()

Public

Returns the comparison status.

public getStatus() : string
Return values
string

Description

the comparison status value

getSummary()

Public

Returns the human-readable summary.

public getSummary() : string
Return values
string

Description

the summary for console output

isChanged()

Public

Reports whether the compared files produced a text diff.

public isChanged() : bool
Return values
bool

Description

true when a text diff is available

isUnchanged()

Public

Reports whether the compared files already match.

public isUnchanged() : bool
Return values
bool

Description

true when the source and target contents are identical