ProviderRegistry::isProviderConfigured( string|WordPressAiClientProvidersclass-string $idOrClassName ): bool

In this article

Checks if a provider is properly configured.

Parameters

$idOrClassNamestring|<span class="WordPressAiClientProvidersclass-string”>WordPressAiClientProvidersclass-stringrequired
The provider ID or class name.

Return

bool True if the provider is configured and ready to use.

Source

public function isProviderConfigured(string $idOrClassName): bool
{
    try {
        $className = $this->resolveProviderClassName($idOrClassName);
        // Use static method from ProviderInterface
        /** @var class-string<ProviderInterface> $className */
        $availability = $className::availability();
        return $availability->isConfigured();
    } catch (InvalidArgumentException $e) {
        return \false;
    }
}

Changelog

VersionDescription
0.1.0Introduced.

User Contributed Notes

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