WordPress\AiClient\Events

BeforeGenerateResultEvent::__clonepublicWP 0.4.2

Performs a deep clone of the event.

This method ensures that message 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: BeforeGenerateResultEvent{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

Changelog

Since 0.4.2 Introduced.

BeforeGenerateResultEvent::__clone() code WP 7.0

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