WordPress\AiClient\Messages\DTO

Message::__clonepublicWP 0.4.2

Performs a deep clone of the message.

This method ensures that message part objects are cloned to prevent modifications to the cloned message from affecting the original.

Method of the class: Message{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

Changelog

Since 0.4.2 Introduced.

Message::__clone() code WP 7.0

public function __clone()
{
    $clonedParts = [];
    foreach ($this->parts as $part) {
        $clonedParts[] = clone $part;
    }
    $this->parts = $clonedParts;
}