AbstractClientDiscoveryStrategy::getCandidates( string $type ): WordPressAiClientProvidersHttpAbstractsarray<array<string,

In this article

{@inheritDoc}

Parameters

$typestringrequired
The type of discovery.

Return

WordPressAiClientProvidersHttpAbstractsarray<array<string, mixed>> The discovery candidates.

Source

public static function getCandidates($type)
{
    if (ClientInterface::class === $type) {
        return [['class' => static function () {
            $psr17Factory = new Psr17Factory();
            return static::createClient($psr17Factory);
        }]];
    }
    $psr17Factories = ['WordPress\AiClientDependencies\Psr\Http\Message\RequestFactoryInterface', 'WordPress\AiClientDependencies\Psr\Http\Message\ResponseFactoryInterface', 'WordPress\AiClientDependencies\Psr\Http\Message\ServerRequestFactoryInterface', 'WordPress\AiClientDependencies\Psr\Http\Message\StreamFactoryInterface', 'WordPress\AiClientDependencies\Psr\Http\Message\UploadedFileFactoryInterface', 'WordPress\AiClientDependencies\Psr\Http\Message\UriFactoryInterface'];
    if (in_array($type, $psr17Factories, \true)) {
        return [['class' => Psr17Factory::class]];
    }
    return [];
}

Changelog

VersionDescription
1.1.0Introduced.

User Contributed Notes

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