Skip to content
docsv0.1.0

GateResult

Domain verdict of a gate evaluation: pass / fail / waived, carrying the fields and evidence whose absence blocked a state transition. This is the workflow engine's domain-specific face of the framework-agnostic core verdict {@see \Milpa\ValueObjects\Verification\VerificationResult} (D8 seam). {@see self::toVerificationResult()} projects this onto the core type and {@see self::fromVerificationResult()} rebuilds it losslessly, so the state machine can speak the core vocabulary at its boundary without changing any of its live consumers.

GateResult::pass()

public static function pass(): self

Crea un resultado exitoso (gate pasado).

GateResult::fail()

public static function fail(string $message, string $gateCode, array $missingFields = [], array $missingEvidence = []): self

Crea un resultado fallido (gate no pasado).

Parameters

Parameters of fail()
NameTypeDescription
$messagestringMensaje descriptivo del fallo
$gateCodestringCódigo del gate que falló
$missingFieldslist<string>Campos requeridos faltantes ['field_name', ...]
$missingEvidencelist<string>Evidencias requeridas faltantes ['evidence_type', ...]

GateResult::waived()

public static function waived(string $gateCode, string $justification): self

Crea un resultado de gate exceptuado (waived). El gate fue saltado por una justificación válida.

Parameters

Parameters of waived()
NameTypeDescription
$gateCodestringCódigo del gate exceptuado
$justificationstringRazón de la excepción

GateResult::isPassed()

public function isPassed(): bool

Verifica si el gate fue superado (pasado o exceptuado).

GateResult::hasMissingFields()

public function hasMissingFields(): bool

Verifica si el resultado tiene campos faltantes.

GateResult::hasMissingEvidence()

public function hasMissingEvidence(): bool

Verifica si el resultado tiene evidencias faltantes.

GateResult::toArray()

public function toArray(): array

Obtiene una representación en array para debugging o logging.

GateResult::toVerificationResult()

public function toVerificationResult(?string $verifier = null, ?string $principal = null): Milpa\ValueObjects\Verification\VerificationResult

Projects this domain verdict onto the framework-agnostic core seam (D8). pass → PASSED, waived → WAIVED (gate code kept in metadata), fail → FAILED with the fields and evidence flattened into the generic `missing` list. The field/evidence split and the gate code survive in `metadata`, so {@see self::fromVerificationResult()} can reconstruct this result without loss. A verifier that runs the gate machinery through the core {@see VerifierInterface} (D9, e.g. {@see \Milpa\Workflow\Verification\StateMachineVerifier}) passes its own identity and the acting principal so the returned verdict is attributable.

Parameters

Parameters of toVerificationResult()
NameTypeDescription
$verifier(string | null)opaque id of the verifier producing this verdict (e.g. "workflow_engine")
$principal(string | null)opaque id of the acting principal (never resolved to an entity)

GateResult::fromVerificationResult()

public static function fromVerificationResult(Milpa\ValueObjects\Verification\VerificationResult $result): self

Rebuilds a domain verdict from a core {@see VerificationResult} — the inverse of {@see self::toVerificationResult()}. A satisfied result (PASSED or WAIVED) maps to a passed gate; FAILED and the async PENDING state map to a non-passing gate. The gate code and field/evidence split are read back from metadata when present, and the reconstruction tolerates a bare core result produced elsewhere (no metadata) without error.

Parameters

Parameters of fromVerificationResult()
NameTypeDescription
$resultMilpa\ValueObjects\Verification\VerificationResult