CapabilityRequirement
A `requires` capability record. Declares a HARD dependency on a contract: at least one installed provider must satisfy `interface` within the semver `constraint` range. `oneOf` optionally lists provider capability ids any of which satisfies the requirement. Legacy bare-FQCN declarations are accepted via {@see fromInterface()}.
CapabilityRequirement::__construct()
public function __construct(string $id, string $interface, string $constraint = '*', array $oneOf = []):Parameters
| Nombre | Tipo | Descripción |
|---|---|---|
| $id | string | |
| $interface | string | |
| $constraint | string | |
| $oneOf | list<string> |
CapabilityRequirement::fromArray()
public static function fromArray(array $record): selfBuild a requirement record from a decoded `requires` manifest entry, validating `id` and `interface`, defaulting `constraint` to `*`, and normalizing `oneOf` to a list of non-empty strings.
Parameters
| Nombre | Tipo | Descripción |
|---|---|---|
| $record | array<string, mixed> |
Throws
\InvalidArgumentException If `id` or `interface` is empty.
CapabilityRequirement::fromInterface()
public static function fromInterface(string $interface): selfWrap a legacy bare-FQCN declaration as an any-version requirement.
Parameters
| Nombre | Tipo | Descripción |
|---|---|---|
| $interface | string |
CapabilityRequirement::parse()
public static function parse(array|string $record): selfParse a `requires` manifest entry in either the legacy bare-FQCN string form or the structured-record array form, dispatching to {@see fromInterface()} or {@see fromArray()}.
Parameters
| Nombre | Tipo | Descripción |
|---|---|---|
| $record | (string | array<string, mixed>) |