final class ConsistencyReport (View source)

Shapes check results and fix-all tallies the same way for every backend strategy.

Methods

static array
build(array $findings, string $allClear, string $status, string $countedFormat)

A check result: success with $allClear when there are no findings, otherwise $status with $countedFormat filled with the number of findings.

static array
allClear(string $message)

No description

static array
repairEach(array $ids, callable $repair, string $successKey)

Apply $repair to every id, counting the outcomes as [$successKey => n, 'failed' => n].

static array
tally(array $counts, string $successKey, string $nothing, string $allFormat, string $partialFormat)

The message for a fix-all outcome from repairEach(): $nothing when there was nothing to repair, $allFormat with the count when every repair succeeded, and $partialFormat with both counts (a warning) otherwise.

static array
findingIds(array $result)

The ids of every finding, for handing to repairEach().

Details

static array build(array $findings, string $allClear, string $status, string $countedFormat)

A check result: success with $allClear when there are no findings, otherwise $status with $countedFormat filled with the number of findings.

Parameters

array $findings
string $allClear
string $status
string $countedFormat

Return Value

array

static array allClear(string $message)

No description

Parameters

string $message

Return Value

array

static array repairEach(array $ids, callable $repair, string $successKey)

Apply $repair to every id, counting the outcomes as [$successKey => n, 'failed' => n].

An exception from a repair counts as a failure and does not stop the run.

Parameters

array $ids
callable $repair
string $successKey

Return Value

array

static array tally(array $counts, string $successKey, string $nothing, string $allFormat, string $partialFormat)

The message for a fix-all outcome from repairEach(): $nothing when there was nothing to repair, $allFormat with the count when every repair succeeded, and $partialFormat with both counts (a warning) otherwise.

Parameters

array $counts
string $successKey
string $nothing
string $allFormat
string $partialFormat

Return Value

array

static array findingIds(array $result)

The ids of every finding, for handing to repairEach().

Parameters

array $result

Return Value

array