CoreFiles by mySites.guru
class-wp-ai-client-discovery-strategy.php37 lines, 1,167 bytes, from wordpress-7.2-beta3.zip
Raw History Compare with 7.2-beta2
md5
5cd00f9a6fe3b6e9330eaa6dd7741870
sha1
dbc7bbd8586d5e8d2ebb1cb317d5970b3f51cca8
sha256
74d19142b3dd8426cd5b2fe9e1a9d8d1489e5f4210ce2123404cf284dec8a3f7
<?php
/**
 * WP AI Client: WP_AI_Client_Discovery_Strategy class
 *
 * @package WordPress
 * @subpackage AI
 * @since 7.0.0
 */

use WordPress\AiClient\Providers\Http\Abstracts\AbstractClientDiscoveryStrategy;
use WordPress\AiClientDependencies\Nyholm\Psr7\Factory\Psr17Factory;
use WordPress\AiClientDependencies\Psr\Http\Client\ClientInterface;

/**
 * Discovery strategy for WordPress HTTP client.
 *
 * Registers the WordPress HTTP client adapter with the HTTPlug discovery system
 * so the AI Client SDK can find and use it automatically.
 *
 * @since 7.0.0
 * @internal Intended only to register WordPress's HTTP client so that the PHP AI Client SDK can use it.
 * @access private
 */
class WP_AI_Client_Discovery_Strategy extends AbstractClientDiscoveryStrategy {

	/**
	 * Creates an instance of the WordPress HTTP client.
	 *
	 * @since 7.0.0
	 *
	 * @param Psr17Factory $psr17_factory The PSR-17 factory for creating HTTP messages.
	 * @return ClientInterface The PSR-18 HTTP client.
	 */
	protected static function createClient( Psr17Factory $psr17_factory ): ClientInterface {
		return new WP_AI_Client_HTTP_Client( $psr17_factory, $psr17_factory );
	}
}

The same content is in 44 releases, WordPress 7.0-beta1 to 7.2-RC2. See them all, or every version of this file.