Skip to content
docsv0.30.2

ConditionReceipt

THE FACT: this operation ran over this content and said this (greenhouse decisions/0615). It is what joins a measurement to an act, and every field is load-bearing: · `by` + `arguments` which operation measured, called how — what a condition's `by` is matched against. · `subject` the digest of the content it measured, computed by the host from the bytes. The same digest tomorrow is still measured; one byte apart is another candidate. · `ok` what the run itself answered. Never a field someone filled in: a verdict that arrives as an argument is a saying. · `instrument` the digest of the operation as it was when it measured ({@see \Milpa\Command\Operation::instrumentDigest()}). What an older instrument found does not hold for the one that replaced it. · `who`, `at` for the reader of the record. The judge joins by content, not by clock. WHAT IT IS NOT: proof that the host wrote it. This is a value; whether a receipt is the house's own is a question about the ledger it was read from, and it is asked there.

ConditionReceipt::__construct()

public function __construct(?mixed $by, array $arguments, string $subject, ?mixed $ok, string $instrument, ?string $who, DateTimeImmutable $at):

Parameters

Parameters of __construct()
NameTypeDescription
$bymixedthe operation that measured, by its name as TEXT, as it reads — never an identity built elsewhere, which has already had its ends taken off: anything but a text is a `TypeError`, whatever the caller's file declares
$argumentsarray<string, mixed>the arguments the measuring call carried
$subjectstring
$okmixedwhat the run answered: `true` or `false`. THE TYPE IS ASKED HERE, NOT LEFT TO THE CALLER'S FILE: from PHP's default mode a parameter typed `bool` reads every text but "" and "0" as true — the word «false», «no», «failed» — before a constructor looks, and a no that was said would be kept as a yes. Anything but a boolean is a `TypeError` for every caller
$instrumentstring
$who?string
$atDateTimeImmutable

Throws

\TypeError when the operation is not given as text, or the answer is not a boolean

ConditionReceipt::toArray()

public function toArray(): array

The receipt as data.

ConditionReceipt::fromArray()

public static function fromArray(array $data): ?self

A receipt back from what a ledger stored, or `null` when the line is not one. `null` and not an exception: this is asked line by line, and it says of ONE line that it is not a receipt. It decides nothing about the book that line is in. WHAT A HOST OWES A LINE IT CAN NO LONGER READ. The judge listens to the LAST receipt about a content, so a red one that stops reading as a receipt leaves the green before it speaking. A host that kept a line as a receipt and gets `null` for it here — because this reader, or its own writer, changed since — treats that line as it treats a grant it can no longer read ({@see StandingGrant::fromJson()}): it is a FAULT of its record, never «nothing was measured», and it says so to the judge in {@see GrantStanding::$recordFault} — which the judge refuses on, and which a host that says nothing is read as not having checked. The `at` of a receipt is for the reader of the record and is read loosely; the judge joins by content, not by clock. `null` IS NOT A RECEIPT, AND THE JUDGE DOES NOT SKIP IT. A host that builds its list with `array_map(ConditionReceipt::fromArray(...), $lines)` hands the judge that `null`, and the judge refuses on it ({@see StandingJudge::judge()}): anything in the list that is not a receipt is a line that was not read. A line whose digests are not as they read — a space or a line break around one, a character nobody sees in one — is not a receipt either: nothing is trimmed, and the judge compares them as text. A line whose `by` does not name one operation is not a receipt: it would be matched against no condition and no instrument, and a red one kept that way stops speaking.

Parameters

Parameters of fromArray()
NameTypeDescription
$dataarray<array-key, mixed>