WordPress\AiClient\Providers\Models\DTO

ModelMetadata::fromArraypublic staticWP 0.1.0

{@inheritDoc}

Method of the class: ModelMetadata{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = ModelMetadata::fromArray( $array ): self;
$array(array) (required)
.

Changelog

Since 0.1.0 Introduced.

ModelMetadata::fromArray() code WP 7.0

public static function fromArray(array $array): self
{
    static::validateFromArrayData($array, [self::KEY_ID, self::KEY_NAME, self::KEY_SUPPORTED_CAPABILITIES, self::KEY_SUPPORTED_OPTIONS]);
    return new self($array[self::KEY_ID], $array[self::KEY_NAME], array_map(static fn(string $capability): CapabilityEnum => CapabilityEnum::from($capability), $array[self::KEY_SUPPORTED_CAPABILITIES]), array_map(static fn(array $optionData): \WordPress\AiClient\Providers\Models\DTO\SupportedOption => \WordPress\AiClient\Providers\Models\DTO\SupportedOption::fromArray($optionData), $array[self::KEY_SUPPORTED_OPTIONS]));
}