ProviderModelsMetadata::__clone()

In this article

Creates a deep clone of this metadata.

Description

Clones the provider metadata and all model metadata objects to ensure the cloned instance is independent of the original.

Source

public function __clone()
{
    // Clone provider metadata
    $this->provider = clone $this->provider;
    // Deep clone models array (ModelMetadata has __clone)
    $clonedModels = [];
    foreach ($this->models as $model) {
        $clonedModels[] = clone $model;
    }
    $this->models = $clonedModels;
}

Changelog

VersionDescription
0.4.2Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.