Pristine upstream, unpacked from the official wordpress.org tarball. https://wordpress.org/wordpress-7.1.1.tar.gz sha1 2a9d68474e8703aa3a66f80427b325e0941b6a1e (published by wordpress.org) sha256 3996fee13448ef12e07e9f0c77db2f655ffa1b7cde71c80a4965d3bf1fb956b3 This branch carries nothing but upstream releases, one commit each, and is never edited. It is the other side of the git-subtree merge that brings security releases into SiriusPress/wordpress/ — see SiriusPress/docs/upstream-merges.md.
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?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 );
|
|
}
|
|
}
|