\Drupal\strata\Diff SubjectDiff

What changed about one subject between two commits.

The mode is derived from the realm rather than passed in, because the realm is what decides how a subject is rendered: an entity has fields with human labels, a config object has a settings tree, a table row has columns, and a file has blocks and no readable content at all. A renderer that had to be told the mode could be told the wrong one.

Summary

Methods
Properties
Constants
__construct
mode
name
title
changedFields
isReadable
summary
jsonSerialize
subject
realm
status
fields
label
problem
CHANGED
ADDED
REMOVED
UNREADABLE
MODE_ENTITY
MODE_CONFIG
MODE_ROW
MODE_FILE
MODE_VALUE
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Constant

CHANGED

CHANGED = 'changed'

The subject exists at both commits and differs.

ADDED

ADDED = 'added'

The subject exists only at the later commit.

REMOVED

REMOVED = 'removed'

The subject exists only at the earlier commit.

UNREADABLE

UNREADABLE = 'unreadable'

The subject could not be read at one or both commits.

MODE_ENTITY

MODE_ENTITY = 'entity'

An entity, rendered as fields.

MODE_CONFIG

MODE_CONFIG = 'config'

A configuration object, rendered as a settings tree.

MODE_ROW

MODE_ROW = 'row'

A database row, rendered as columns.

MODE_FILE

MODE_FILE = 'file'

A file, rendered as blocks and sizes.

MODE_VALUE

MODE_VALUE = 'value'

Anything else, rendered as key and value.

Properties

$subject

$subject : string

Type

string

$realm

$realm : ?\Drupal\strata\Journal\Realm

Type

Realm|null

$status

$status : string

Type

string

$fields

$fields : array

Type

array<string|int, mixed>

$label

$label : string

Type

string

$problem

$problem : ?string

Type

string|null

Methods

__construct()

__construct(string  $subject, \Drupal\strata\Journal\Realm|null  $realm, string  $status, list<\Drupal\strata\Diff\FieldDiff>  $fields = [], string  $label = '', string|null  $problem = null) : mixed

Constructs a subject diff.

Parameters

string $subject

Subject path, in the form <realm>/<name>.

\Drupal\strata\Journal\Realm|null $realm

The realm, or NULL when the path names one this release does not know.

string $status

One of CHANGED, ADDED, REMOVED or UNREADABLE.

list<\Drupal\strata\Diff\FieldDiff> $fields

What changed inside it.

string $label

A human-readable name for the subject, when one is known.

string|null $problem

Why it could not be read, when it could not.

Returns

mixed —

mode()

mode() : string

How this subject should be rendered.

Returns

string —

One of the MODE constants.

name()

name() : string

The part of the subject path after the realm.

Returns

string —

The name.

title()

title() : string

What to show as this subject's title.

Returns

string —

The label when one is known, otherwise the name.

changedFields()

changedFields() : int

How many fields changed.

Returns

int —

The count.

isReadable()

isReadable() : bool

Whether this subject could be read at both commits.

Returns

bool —

FALSE when something did not decode.

summary()

summary() : string

A one-line summary.

Returns

string —

What happened to this subject.

jsonSerialize()

jsonSerialize() : array

{@inheritdoc}

Returns

array —