WordPress\AiClient\Results\DTO
GenerativeAiResult::__clone
Performs a deep clone of the result.
This method ensures that all nested objects (candidates, token usage, metadata) are cloned to prevent modifications to the cloned result from affecting the original.
Метод класса: GenerativeAiResult{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$GenerativeAiResult = new GenerativeAiResult(); $GenerativeAiResult->__clone();
Список изменений
| С версии 0.4.2 | Введена. |
Код GenerativeAiResult::__clone() GenerativeAiResult:: clone WP 7.1.4
public function __clone()
{
$clonedCandidates = [];
foreach ($this->candidates as $candidate) {
$clonedCandidates[] = clone $candidate;
}
$this->candidates = $clonedCandidates;
$this->tokenUsage = clone $this->tokenUsage;
$this->providerMetadata = clone $this->providerMetadata;
$this->modelMetadata = clone $this->modelMetadata;
}