ManifestData
Internal helpers that turn a decoded manifest array into validated, strictly-typed value-object fields. Every failure surfaces as an {@see InvalidManifestException}; callers pass the value-object `$type` (and, where known, the record `$subject`) so a failure names the exact offending entry. Shared by the manifest value objects so version and required-field validation is defined once.
ManifestData::requireString()
public static function requireString(array $data, string $key, string $type, ?string $subject = null): stringExtract a required, non-empty string field.
Parameters
| Name | Type | Description |
|---|---|---|
| $data | array<string, mixed> | |
| $key | string | |
| $type | string | |
| $subject | ?string |
Throws
InvalidManifestException When the field is absent or empty.
ManifestData::requireSemver()
public static function requireSemver(array $data, string $key, string $type, ?string $subject = null): stringExtract a required field and assert it parses as a semantic version. Uses composer/semver's parser, which is lenient enough for two-part contract versions (`0.1`) and calendar host versions (`2026.07`) yet still rejects non-versions.
Parameters
| Name | Type | Description |
|---|---|---|
| $data | array<string, mixed> | |
| $key | string | |
| $type | string | |
| $subject | ?string |
Throws
InvalidManifestException When the field is absent or not a valid version.
ManifestData::requireArray()
public static function requireArray(array $data, string $key, string $type, ?string $subject = null): arrayExtract a required array field (also used for nested value objects such as the host profile).
Parameters
| Name | Type | Description |
|---|---|---|
| $data | array<string, mixed> | |
| $key | string | |
| $type | string | |
| $subject | ?string |
Throws
InvalidManifestException When the field is absent or not an array.
ManifestData::optionalArray()
public static function optionalArray(array $data, string $key): arrayExtract an optional array field, defaulting to an empty array.
Parameters
| Name | Type | Description |
|---|---|---|
| $data | array<string, mixed> | |
| $key | string |
ManifestData::optionalString()
public static function optionalString(array $data, string $key): ?stringExtract an optional non-empty string field, defaulting to null.
Parameters
| Name | Type | Description |
|---|---|---|
| $data | array<string, mixed> | |
| $key | string |
ManifestData::optionalIsoDate()
public static function optionalIsoDate(array $data, string $key, string $type, ?string $subject = null): ?stringExtract an optional ISO-8601 date/datetime field, defaulting to null. Present-but-unparseable values throw so an expiry can be trusted. Relative expressions ("now", "tomorrow", "+1 day") are rejected as non-ISO on purpose: they would make parsing read the wall clock and break the resolver's purity — the clock is data the caller supplies, never an ambient read.
Parameters
| Name | Type | Description |
|---|---|---|
| $data | array<string, mixed> | |
| $key | string | |
| $type | string | |
| $subject | ?string |
Throws
InvalidManifestException When the field is present but not a valid ISO-8601 date.
ManifestData::isIsoDate()
public static function isIsoDate(string $value): boolWhether a string is an ISO-8601 date or datetime: year-first shape (so relative expressions are rejected) that the datetime parser also accepts.
Parameters
| Name | Type | Description |
|---|---|---|
| $value | string |
ManifestData::stringList()
public static function stringList(array $data, string $key): arrayCoerce an optional field into a list of non-empty strings, dropping non-scalar entries.
Parameters
| Name | Type | Description |
|---|---|---|
| $data | array<string, mixed> | |
| $key | string |
ManifestData::recordList()
public static function recordList(array $data, string $key): arrayCoerce an optional field into a list of associative records, dropping non-array entries. Each record is ready to hand to another value object's `fromArray()`.
Parameters
| Name | Type | Description |
|---|---|---|
| $data | array<string, mixed> | |
| $key | string |