WordPress\AiClient\Results\DTO

Candidate::fromArraypublic staticWP 0.1.0

{@inheritDoc}

Method of the class: Candidate{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

Changelog

Since 0.1.0 Introduced.

Candidate::fromArray() code WP 7.0

public static function fromArray(array $array): self
{
    static::validateFromArrayData($array, [self::KEY_MESSAGE, self::KEY_FINISH_REASON]);
    $messageData = $array[self::KEY_MESSAGE];
    return new self(Message::fromArray($messageData), FinishReasonEnum::from($array[self::KEY_FINISH_REASON]));
}