WordPress\AiClient\Events

AfterGenerateResultEvent::__clonepublicWP 0.4.2

Performs a deep clone of the event.

This method ensures that message and result objects are cloned to prevent modifications to the cloned event from affecting the original. The model object is not cloned as it is a service object.

Method of the class: AfterGenerateResultEvent{}

No Hooks.

Returns

null. Nothing (null).

Usage

$AfterGenerateResultEvent = new AfterGenerateResultEvent();
$AfterGenerateResultEvent->__clone();

Changelog

Since 0.4.2 Introduced.

AfterGenerateResultEvent::__clone() code WP 7.0

public function __clone()
{
    $clonedMessages = [];
    foreach ($this->messages as $message) {
        $clonedMessages[] = clone $message;
    }
    $this->messages = $clonedMessages;
    $this->result = clone $this->result;
}