CapabilityProvision
A `provides` capability record. Declares that a plugin offers a concrete implementation (`service`) of a stable contract (`interface`) at a given `contractVersion`. Also accepts the legacy bare-FQCN string form via {@see fromInterface()} so legacy manifests (`contracts.provides = ["Foo\\BarInterface"]`) keep working until the capability records are fully adopted.
CapabilityProvision::__construct()
public function __construct(string $id, string $interface, string $contractVersion, ?string $service = null, int $priority = 0, bool $exclusive = false):Parameters
| Nombre | Tipo | Descripción |
|---|---|---|
| $id | string | |
| $interface | string | |
| $contractVersion | string | |
| $service | ?string | |
| $priority | int | |
| $exclusive | bool |
CapabilityProvision::fromArray()
public static function fromArray(array $record): selfBuild a provision record from a decoded `provides` manifest entry, validating `id`, `interface`, and `contractVersion` (must be valid semver).
Parameters
| Nombre | Tipo | Descripción |
|---|---|---|
| $record | array<string, mixed> |
Throws
\InvalidArgumentException If `id`/`interface` are empty or `contractVersion` is not valid semver.
CapabilityProvision::fromInterface()
public static function fromInterface(string $interface): selfWrap a legacy bare-FQCN declaration as an unversioned record.
Parameters
| Nombre | Tipo | Descripción |
|---|---|---|
| $interface | string |
CapabilityProvision::parse()
public static function parse(array|string $record): selfParse a `provides` 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>) |