Skip to content
docs

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

Parámetros de __construct()
NombreTipoDescripción
$idstring
$interfacestring
$contractVersionstring
$service?string
$priorityint
$exclusivebool

CapabilityProvision::fromArray()

public static function fromArray(array $record): self

Build a provision record from a decoded `provides` manifest entry, validating `id`, `interface`, and `contractVersion` (must be valid semver).

Parameters

Parámetros de fromArray()
NombreTipoDescripción
$recordarray<string, mixed>

Throws

\InvalidArgumentException If `id`/`interface` are empty or `contractVersion` is not valid semver.

CapabilityProvision::fromInterface()

public static function fromInterface(string $interface): self

Wrap a legacy bare-FQCN declaration as an unversioned record.

Parameters

Parámetros de fromInterface()
NombreTipoDescripción
$interfacestring

CapabilityProvision::parse()

public static function parse(array|string $record): self

Parse 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

Parámetros de parse()
NombreTipoDescripción
$record(string | array<string, mixed>)