\Drupal\strata\Branch MergeResult

What a merge actually did, against what it planned to.

Separate from the plan for the reason a restore result is: the two disagree in exactly the cases worth reading. An object that planned as writable and then failed to save - a config schema constraint, a dependency that is no longer installed - is the interesting half, and folding it back into the plan would hide it.

Two commits are named. The snapshot is the state of the site before anything was written, which is what makes the merge undoable; the merge commit is the two-parent commit that puts the branch's history behind the target's, which is what stops a prune collecting it.

Summary

Methods
Properties
Constants
__construct
refuse
dryRun
wasRefused
isComplete
summary
fromRestore
jsonSerialize
plan
applied
snapshot
commit
written
failed
refused
seconds
No public constants found
No protected methods found
No protected properties found
No protected constants found
objectName
No private properties found
No private constants found

Properties

$plan

$plan : \Drupal\strata\Branch\MergePlan

Type

MergePlan

$applied

$applied : bool

Type

bool

$snapshot

$snapshot : ?string

Type

string|null

$commit

$commit : ?string

Type

string|null

$written

$written : array

Type

array<string|int, mixed>

$failed

$failed : array

Type

array<string|int, mixed>

$refused

$refused : ?string

Type

string|null

$seconds

$seconds : float

Type

float

Methods

__construct()

__construct(\Drupal\strata\Branch\MergePlan  $plan, bool  $applied = false, string|null  $snapshot = null, string|null  $commit = null, list  $written = [], array  $failed = [], string|null  $refused = null, float  $seconds = 0.0) : mixed

Constructs a result.

Parameters

\Drupal\strata\Branch\MergePlan $plan

The plan that was applied.

bool $applied

FALSE for a dry run, which builds the plan and writes nothing.

string|null $snapshot

Commit sealed before anything was written, so the merge can be undone.

string|null $commit

The two-parent merge commit, or NULL when nothing was written.

list $written

Configuration object names saved back to the site.

array $failed

Object name keyed to why saving it did not work.

string|null $refused

Why the merge did not start, or NULL when it ran.

float $seconds

How long it took.

Returns

mixed —

refuse()

refuse(\Drupal\strata\Branch\MergePlan  $plan, string  $reason) : self

A result for a merge that declined to start.

Parameters

\Drupal\strata\Branch\MergePlan $plan

The plan it would have applied.

string $reason

Why it refused.

Returns

self —

The result.

dryRun()

dryRun(\Drupal\strata\Branch\MergePlan  $plan) : self

A result for a merge that was only planned.

Parameters

\Drupal\strata\Branch\MergePlan $plan

The plan.

Returns

self —

The result.

wasRefused()

wasRefused() : bool

Whether the merge declined to start.

Returns

bool —

TRUE when it refused.

isComplete()

isComplete() : bool

Whether everything the plan named was written.

Returns

bool —

TRUE when the merge ran and nothing failed.

summary()

summary() : string

A one-line summary for a log entry or a command's output.

Returns

string —

The summary.

fromRestore()

fromRestore(\Drupal\strata\Branch\MergePlan  $plan, \Drupal\strata\Restore\RestoreResult  $restore, string|null  $commit, float  $seconds) : self

A result built from what a logical restore reported.

Parameters

\Drupal\strata\Branch\MergePlan $plan

The plan that was applied.

\Drupal\strata\Restore\RestoreResult $restore

What the restore wrote.

string|null $commit

The merge commit, or NULL when none was written.

float $seconds

How long the whole merge took.

Returns

self —

The result, with each subject path shortened back to the configuration object name.

jsonSerialize()

jsonSerialize() : array<string,mixed>

{@inheritdoc}

Returns

array

The result as a plain array.

objectName()

objectName(string  $subject) : string

The configuration object name a subject path carries.

Parameters

string $subject

The subject path, such as config/system.site.

Returns

string —

The object name, or the path unchanged when it names no realm.