WordPress\AiClient\Providers\Http\Abstracts

AbstractClientDiscoveryStrategy::getCandidatespublic staticWP 1.1.0

{@inheritDoc}

Method of the class: AbstractClientDiscoveryStrategy{}

No Hooks.

Returns

Array. mixed>> The discovery candidates.

Usage

$result = AbstractClientDiscoveryStrategy::getCandidates( $type );
$type(string) (required)
The type of discovery.

Changelog

Since 1.1.0 Introduced.

AbstractClientDiscoveryStrategy::getCandidates() code WP 7.0

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 [];
}