XhtmlStateTransferCodec
The plain (unsigned) {@see StateTransferCodecInterface}: encodes a {@see StateSnapshot} / {@see InteractionRequest} as a single `<milpa-state>` / `<milpa-interaction>` XHTML element carrying a base64-encoded JSON payload, and decodes it back. Tamper-evidence and replay protection are NOT provided here — this codec is the `$inner` layer {@see \Milpa\Live\Security\SignedXhtmlStateTransferCodec} wraps to add HMAC signing on top; use the signed codec directly whenever the envelope will round-trip through an untrusted client.
XhtmlStateTransferCodec::encodeState()
public function encodeState(Milpa\Live\ValueObjects\StateSnapshot $snapshot): stringEncodes `$snapshot` as a `<milpa-state>` element whose text content is the base64-encoded JSON of its id/name/version/data/meta.
Parameters
| Name | Type | Description |
|---|---|---|
| $snapshot | Milpa\Live\ValueObjects\StateSnapshot |
XhtmlStateTransferCodec::decodeState()
public function decodeState(string $encoded): Milpa\Live\ValueObjects\StateSnapshotParses `$encoded` as a single `<milpa-state>` XML element and decodes its payload back into a {@see StateSnapshot}. Throws `RuntimeException` for malformed XML, a wrong root tag, or invalid base64/JSON in the payload.
Parameters
| Name | Type | Description |
|---|---|---|
| $encoded | string |
XhtmlStateTransferCodec::encodeInteraction()
public function encodeInteraction(Milpa\Live\ValueObjects\InteractionRequest $request): stringEncodes `$request` as a `<milpa-interaction>` element whose text content is the base64-encoded JSON of its id/name/action/state/payload/meta.
Parameters
| Name | Type | Description |
|---|---|---|
| $request | Milpa\Live\ValueObjects\InteractionRequest |
XhtmlStateTransferCodec::decodeInteraction()
public function decodeInteraction(string $encoded): Milpa\Live\ValueObjects\InteractionRequestParses `$encoded` as a single `<milpa-interaction>` XML element and decodes its payload back into an {@see InteractionRequest}. Throws `RuntimeException` for malformed XML, a wrong root tag, or invalid base64/JSON in the payload.
Parameters
| Name | Type | Description |
|---|---|---|
| $encoded | string |