WordPress\AiClient\Providers\Models\DTO

ModelConfig::__clonepublicWP 0.4.2

Creates a deep clone of this configuration.

Clones nested objects (functionDeclarations, webSearch) to ensure the cloned configuration is independent of the original. Enum value objects (outputModalities, outputFileType, outputMediaOrientation) are intentionally shared as they are immutable.

Method of the class: ModelConfig{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

Changelog

Since 0.4.2 Introduced.

ModelConfig::__clone() code WP 7.0

public function __clone()
{
    // Deep clone function declarations if set
    if ($this->functionDeclarations !== null) {
        $clonedDeclarations = [];
        foreach ($this->functionDeclarations as $declaration) {
            $clonedDeclarations[] = clone $declaration;
        }
        $this->functionDeclarations = $clonedDeclarations;
    }
    // Clone web search if set
    if ($this->webSearch !== null) {
        $this->webSearch = clone $this->webSearch;
    }
    // Note: Enum value objects (outputModalities, outputFileType, outputMediaOrientation)
    // are immutable and can be safely shared.
}