This commit is contained in:
Marek
2026-03-24 00:04:55 +01:00
commit c5229e48ed
4225 changed files with 511461 additions and 0 deletions

View File

@@ -0,0 +1,124 @@
<?php
namespace Symfony\Config\Framework\HttpClient\DefaultOptions;
use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* This class is automatically generated to help in creating a config.
*/
class CachingConfig
{
private $enabled;
private $cachePool;
private $shared;
private $maxTtl;
private $_usedProperties = [];
/**
* @default false
* @param ParamConfigurator|bool $value
* @return $this
*/
public function enabled($value): static
{
$this->_usedProperties['enabled'] = true;
$this->enabled = $value;
return $this;
}
/**
* The taggable cache pool to use for storing the responses.
* @default 'cache.http_client'
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function cachePool($value): static
{
$this->_usedProperties['cachePool'] = true;
$this->cachePool = $value;
return $this;
}
/**
* Indicates whether the cache is shared (public) or private.
* @default true
* @param ParamConfigurator|bool $value
* @return $this
*/
public function shared($value): static
{
$this->_usedProperties['shared'] = true;
$this->shared = $value;
return $this;
}
/**
* The maximum TTL (in seconds) allowed for cached responses. Null means no cap.
* @default null
* @param ParamConfigurator|int $value
* @return $this
*/
public function maxTtl($value): static
{
$this->_usedProperties['maxTtl'] = true;
$this->maxTtl = $value;
return $this;
}
public function __construct(array $config = [])
{
if (array_key_exists('enabled', $config)) {
$this->_usedProperties['enabled'] = true;
$this->enabled = $config['enabled'];
unset($config['enabled']);
}
if (array_key_exists('cache_pool', $config)) {
$this->_usedProperties['cachePool'] = true;
$this->cachePool = $config['cache_pool'];
unset($config['cache_pool']);
}
if (array_key_exists('shared', $config)) {
$this->_usedProperties['shared'] = true;
$this->shared = $config['shared'];
unset($config['shared']);
}
if (array_key_exists('max_ttl', $config)) {
$this->_usedProperties['maxTtl'] = true;
$this->maxTtl = $config['max_ttl'];
unset($config['max_ttl']);
}
if ($config) {
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($config)));
}
}
public function toArray(): array
{
$output = [];
if (isset($this->_usedProperties['enabled'])) {
$output['enabled'] = $this->enabled;
}
if (isset($this->_usedProperties['cachePool'])) {
$output['cache_pool'] = $this->cachePool;
}
if (isset($this->_usedProperties['shared'])) {
$output['shared'] = $this->shared;
}
if (isset($this->_usedProperties['maxTtl'])) {
$output['max_ttl'] = $this->maxTtl;
}
return $output;
}
}

View File

@@ -0,0 +1,101 @@
<?php
namespace Symfony\Config\Framework\HttpClient\DefaultOptions;
use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* This class is automatically generated to help in creating a config.
*/
class PeerFingerprintConfig
{
private $sha1;
private $pinsha256;
private $md5;
private $_usedProperties = [];
/**
* @default null
* @param ParamConfigurator|mixed $value
*
* @return $this
*/
public function sha1(mixed $value): static
{
$this->_usedProperties['sha1'] = true;
$this->sha1 = $value;
return $this;
}
/**
* @default null
* @param ParamConfigurator|mixed $value
*
* @return $this
*/
public function pinsha256(mixed $value): static
{
$this->_usedProperties['pinsha256'] = true;
$this->pinsha256 = $value;
return $this;
}
/**
* @default null
* @param ParamConfigurator|mixed $value
*
* @return $this
*/
public function md5(mixed $value): static
{
$this->_usedProperties['md5'] = true;
$this->md5 = $value;
return $this;
}
public function __construct(array $config = [])
{
if (array_key_exists('sha1', $config)) {
$this->_usedProperties['sha1'] = true;
$this->sha1 = $config['sha1'];
unset($config['sha1']);
}
if (array_key_exists('pin-sha256', $config)) {
$this->_usedProperties['pinsha256'] = true;
$this->pinsha256 = $config['pin-sha256'];
unset($config['pin-sha256']);
}
if (array_key_exists('md5', $config)) {
$this->_usedProperties['md5'] = true;
$this->md5 = $config['md5'];
unset($config['md5']);
}
if ($config) {
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($config)));
}
}
public function toArray(): array
{
$output = [];
if (isset($this->_usedProperties['sha1'])) {
$output['sha1'] = $this->sha1;
}
if (isset($this->_usedProperties['pinsha256'])) {
$output['pin-sha256'] = $this->pinsha256;
}
if (isset($this->_usedProperties['md5'])) {
$output['md5'] = $this->md5;
}
return $output;
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailed;
use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* This class is automatically generated to help in creating a config.
*/
class HttpCodeConfig
{
private $code;
private $methods;
private $_usedProperties = [];
/**
* @default null
* @param ParamConfigurator|int $value
* @return $this
*/
public function code($value): static
{
$this->_usedProperties['code'] = true;
$this->code = $value;
return $this;
}
/**
* @param ParamConfigurator|list<ParamConfigurator|mixed>|string $value
*
* @return $this
*/
public function methods(ParamConfigurator|string|array $value): static
{
$this->_usedProperties['methods'] = true;
$this->methods = $value;
return $this;
}
public function __construct(array $config = [])
{
if (array_key_exists('code', $config)) {
$this->_usedProperties['code'] = true;
$this->code = $config['code'];
unset($config['code']);
}
if (array_key_exists('methods', $config)) {
$this->_usedProperties['methods'] = true;
$this->methods = $config['methods'];
unset($config['methods']);
}
if ($config) {
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($config)));
}
}
public function toArray(): array
{
$output = [];
if (isset($this->_usedProperties['code'])) {
$output['code'] = $this->code;
}
if (isset($this->_usedProperties['methods'])) {
$output['methods'] = $this->methods;
}
return $output;
}
}

View File

@@ -0,0 +1,222 @@
<?php
namespace Symfony\Config\Framework\HttpClient\DefaultOptions;
require_once __DIR__.\DIRECTORY_SEPARATOR.'RetryFailed'.\DIRECTORY_SEPARATOR.'HttpCodeConfig.php';
use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* This class is automatically generated to help in creating a config.
*/
class RetryFailedConfig
{
private $enabled;
private $retryStrategy;
private $httpCodes;
private $maxRetries;
private $delay;
private $multiplier;
private $maxDelay;
private $jitter;
private $_usedProperties = [];
/**
* @default false
* @param ParamConfigurator|bool $value
* @return $this
*/
public function enabled($value): static
{
$this->_usedProperties['enabled'] = true;
$this->enabled = $value;
return $this;
}
/**
* service id to override the retry strategy.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function retryStrategy($value): static
{
$this->_usedProperties['retryStrategy'] = true;
$this->retryStrategy = $value;
return $this;
}
/**
* A list of HTTP status code that triggers a retry.
*/
public function httpCode(string $code, array $value = []): \Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailed\HttpCodeConfig
{
if (!isset($this->httpCodes[$code])) {
$this->_usedProperties['httpCodes'] = true;
$this->httpCodes[$code] = new \Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailed\HttpCodeConfig($value);
} elseif (1 < \func_num_args()) {
throw new InvalidConfigurationException('The node created by "httpCode()" has already been initialized. You cannot pass values the second time you call httpCode().');
}
return $this->httpCodes[$code];
}
/**
* @default 3
* @param ParamConfigurator|int $value
* @return $this
*/
public function maxRetries($value): static
{
$this->_usedProperties['maxRetries'] = true;
$this->maxRetries = $value;
return $this;
}
/**
* Time in ms to delay (or the initial value when multiplier is used).
* @default 1000
* @param ParamConfigurator|int $value
* @return $this
*/
public function delay($value): static
{
$this->_usedProperties['delay'] = true;
$this->delay = $value;
return $this;
}
/**
* If greater than 1, delay will grow exponentially for each retry: delay * (multiple ^ retries).
* @default 2
* @param ParamConfigurator|float $value
* @return $this
*/
public function multiplier($value): static
{
$this->_usedProperties['multiplier'] = true;
$this->multiplier = $value;
return $this;
}
/**
* Max time in ms that a retry should ever be delayed (0 = infinite).
* @default 0
* @param ParamConfigurator|int $value
* @return $this
*/
public function maxDelay($value): static
{
$this->_usedProperties['maxDelay'] = true;
$this->maxDelay = $value;
return $this;
}
/**
* Randomness in percent (between 0 and 1) to apply to the delay.
* @default 0.1
* @param ParamConfigurator|float $value
* @return $this
*/
public function jitter($value): static
{
$this->_usedProperties['jitter'] = true;
$this->jitter = $value;
return $this;
}
public function __construct(array $config = [])
{
if (array_key_exists('enabled', $config)) {
$this->_usedProperties['enabled'] = true;
$this->enabled = $config['enabled'];
unset($config['enabled']);
}
if (array_key_exists('retry_strategy', $config)) {
$this->_usedProperties['retryStrategy'] = true;
$this->retryStrategy = $config['retry_strategy'];
unset($config['retry_strategy']);
}
if (array_key_exists('http_codes', $config)) {
$this->_usedProperties['httpCodes'] = true;
$this->httpCodes = array_map(fn ($v) => \is_array($v) ? new \Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailed\HttpCodeConfig($v) : $v, $config['http_codes']);
unset($config['http_codes']);
}
if (array_key_exists('max_retries', $config)) {
$this->_usedProperties['maxRetries'] = true;
$this->maxRetries = $config['max_retries'];
unset($config['max_retries']);
}
if (array_key_exists('delay', $config)) {
$this->_usedProperties['delay'] = true;
$this->delay = $config['delay'];
unset($config['delay']);
}
if (array_key_exists('multiplier', $config)) {
$this->_usedProperties['multiplier'] = true;
$this->multiplier = $config['multiplier'];
unset($config['multiplier']);
}
if (array_key_exists('max_delay', $config)) {
$this->_usedProperties['maxDelay'] = true;
$this->maxDelay = $config['max_delay'];
unset($config['max_delay']);
}
if (array_key_exists('jitter', $config)) {
$this->_usedProperties['jitter'] = true;
$this->jitter = $config['jitter'];
unset($config['jitter']);
}
if ($config) {
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($config)));
}
}
public function toArray(): array
{
$output = [];
if (isset($this->_usedProperties['enabled'])) {
$output['enabled'] = $this->enabled;
}
if (isset($this->_usedProperties['retryStrategy'])) {
$output['retry_strategy'] = $this->retryStrategy;
}
if (isset($this->_usedProperties['httpCodes'])) {
$output['http_codes'] = array_map(fn ($v) => $v instanceof \Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailed\HttpCodeConfig ? $v->toArray() : $v, $this->httpCodes);
}
if (isset($this->_usedProperties['maxRetries'])) {
$output['max_retries'] = $this->maxRetries;
}
if (isset($this->_usedProperties['delay'])) {
$output['delay'] = $this->delay;
}
if (isset($this->_usedProperties['multiplier'])) {
$output['multiplier'] = $this->multiplier;
}
if (isset($this->_usedProperties['maxDelay'])) {
$output['max_delay'] = $this->maxDelay;
}
if (isset($this->_usedProperties['jitter'])) {
$output['jitter'] = $this->jitter;
}
return $output;
}
}

View File

@@ -0,0 +1,623 @@
<?php
namespace Symfony\Config\Framework\HttpClient;
require_once __DIR__.\DIRECTORY_SEPARATOR.'DefaultOptions'.\DIRECTORY_SEPARATOR.'PeerFingerprintConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'DefaultOptions'.\DIRECTORY_SEPARATOR.'CachingConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'DefaultOptions'.\DIRECTORY_SEPARATOR.'RetryFailedConfig.php';
use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* This class is automatically generated to help in creating a config.
*/
class DefaultOptionsConfig
{
private $headers;
private $vars;
private $maxRedirects;
private $httpVersion;
private $resolve;
private $proxy;
private $noProxy;
private $timeout;
private $maxDuration;
private $bindto;
private $verifyPeer;
private $verifyHost;
private $cafile;
private $capath;
private $localCert;
private $localPk;
private $passphrase;
private $ciphers;
private $peerFingerprint;
private $cryptoMethod;
private $extra;
private $rateLimiter;
private $caching;
private $retryFailed;
private $_usedProperties = [];
/**
* @return $this
*/
public function header(string $name, mixed $value): static
{
$this->_usedProperties['headers'] = true;
$this->headers[$name] = $value;
return $this;
}
/**
* @return $this
*/
public function var(string $name, mixed $value): static
{
$this->_usedProperties['vars'] = true;
$this->vars[$name] = $value;
return $this;
}
/**
* The maximum number of redirects to follow.
* @default null
* @param ParamConfigurator|int $value
* @return $this
*/
public function maxRedirects($value): static
{
$this->_usedProperties['maxRedirects'] = true;
$this->maxRedirects = $value;
return $this;
}
/**
* The default HTTP version, typically 1.1 or 2.0, leave to null for the best version.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function httpVersion($value): static
{
$this->_usedProperties['httpVersion'] = true;
$this->httpVersion = $value;
return $this;
}
/**
* @return $this
*/
public function resolve(string $host, mixed $value): static
{
$this->_usedProperties['resolve'] = true;
$this->resolve[$host] = $value;
return $this;
}
/**
* The URL of the proxy to pass requests through or null for automatic detection.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function proxy($value): static
{
$this->_usedProperties['proxy'] = true;
$this->proxy = $value;
return $this;
}
/**
* A comma separated list of hosts that do not require a proxy to be reached.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function noProxy($value): static
{
$this->_usedProperties['noProxy'] = true;
$this->noProxy = $value;
return $this;
}
/**
* The idle timeout, defaults to the "default_socket_timeout" ini parameter.
* @default null
* @param ParamConfigurator|float $value
* @return $this
*/
public function timeout($value): static
{
$this->_usedProperties['timeout'] = true;
$this->timeout = $value;
return $this;
}
/**
* The maximum execution time for the request+response as a whole.
* @default null
* @param ParamConfigurator|float $value
* @return $this
*/
public function maxDuration($value): static
{
$this->_usedProperties['maxDuration'] = true;
$this->maxDuration = $value;
return $this;
}
/**
* A network interface name, IP address, a host name or a UNIX socket to bind to.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function bindto($value): static
{
$this->_usedProperties['bindto'] = true;
$this->bindto = $value;
return $this;
}
/**
* Indicates if the peer should be verified in a TLS context.
* @default null
* @param ParamConfigurator|bool $value
* @return $this
*/
public function verifyPeer($value): static
{
$this->_usedProperties['verifyPeer'] = true;
$this->verifyPeer = $value;
return $this;
}
/**
* Indicates if the host should exist as a certificate common name.
* @default null
* @param ParamConfigurator|bool $value
* @return $this
*/
public function verifyHost($value): static
{
$this->_usedProperties['verifyHost'] = true;
$this->verifyHost = $value;
return $this;
}
/**
* A certificate authority file.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function cafile($value): static
{
$this->_usedProperties['cafile'] = true;
$this->cafile = $value;
return $this;
}
/**
* A directory that contains multiple certificate authority files.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function capath($value): static
{
$this->_usedProperties['capath'] = true;
$this->capath = $value;
return $this;
}
/**
* A PEM formatted certificate file.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function localCert($value): static
{
$this->_usedProperties['localCert'] = true;
$this->localCert = $value;
return $this;
}
/**
* A private key file.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function localPk($value): static
{
$this->_usedProperties['localPk'] = true;
$this->localPk = $value;
return $this;
}
/**
* The passphrase used to encrypt the "local_pk" file.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function passphrase($value): static
{
$this->_usedProperties['passphrase'] = true;
$this->passphrase = $value;
return $this;
}
/**
* A list of TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...)
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function ciphers($value): static
{
$this->_usedProperties['ciphers'] = true;
$this->ciphers = $value;
return $this;
}
/**
* Associative array: hashing algorithm => hash(es).
*/
public function peerFingerprint(array $value = []): \Symfony\Config\Framework\HttpClient\DefaultOptions\PeerFingerprintConfig
{
if (null === $this->peerFingerprint) {
$this->_usedProperties['peerFingerprint'] = true;
$this->peerFingerprint = new \Symfony\Config\Framework\HttpClient\DefaultOptions\PeerFingerprintConfig($value);
} elseif (0 < \func_num_args()) {
throw new InvalidConfigurationException('The node created by "peerFingerprint()" has already been initialized. You cannot pass values the second time you call peerFingerprint().');
}
return $this->peerFingerprint;
}
/**
* The minimum version of TLS to accept; must be one of STREAM_CRYPTO_METHOD_TLSv*_CLIENT constants.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function cryptoMethod($value): static
{
$this->_usedProperties['cryptoMethod'] = true;
$this->cryptoMethod = $value;
return $this;
}
/**
* @return $this
*/
public function extra(string $name, mixed $value): static
{
$this->_usedProperties['extra'] = true;
$this->extra[$name] = $value;
return $this;
}
/**
* Rate limiter name to use for throttling requests.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function rateLimiter($value): static
{
$this->_usedProperties['rateLimiter'] = true;
$this->rateLimiter = $value;
return $this;
}
/**
* @template TValue of array|bool
* @param TValue $value
* Caching configuration.
* @default {"enabled":false,"cache_pool":"cache.http_client","shared":true,"max_ttl":null}
* @return \Symfony\Config\Framework\HttpClient\DefaultOptions\CachingConfig|$this
* @psalm-return (TValue is array ? \Symfony\Config\Framework\HttpClient\DefaultOptions\CachingConfig : static)
*/
public function caching(array|bool $value = []): \Symfony\Config\Framework\HttpClient\DefaultOptions\CachingConfig|static
{
if (!\is_array($value)) {
$this->_usedProperties['caching'] = true;
$this->caching = $value;
return $this;
}
if (!$this->caching instanceof \Symfony\Config\Framework\HttpClient\DefaultOptions\CachingConfig) {
$this->_usedProperties['caching'] = true;
$this->caching = new \Symfony\Config\Framework\HttpClient\DefaultOptions\CachingConfig($value);
} elseif (0 < \func_num_args()) {
throw new InvalidConfigurationException('The node created by "caching()" has already been initialized. You cannot pass values the second time you call caching().');
}
return $this->caching;
}
/**
* @template TValue of array|bool
* @param TValue $value
* @default {"enabled":false,"retry_strategy":null,"http_codes":[],"max_retries":3,"delay":1000,"multiplier":2,"max_delay":0,"jitter":0.1}
* @return \Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailedConfig|$this
* @psalm-return (TValue is array ? \Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailedConfig : static)
*/
public function retryFailed(array|bool $value = []): \Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailedConfig|static
{
if (!\is_array($value)) {
$this->_usedProperties['retryFailed'] = true;
$this->retryFailed = $value;
return $this;
}
if (!$this->retryFailed instanceof \Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailedConfig) {
$this->_usedProperties['retryFailed'] = true;
$this->retryFailed = new \Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailedConfig($value);
} elseif (0 < \func_num_args()) {
throw new InvalidConfigurationException('The node created by "retryFailed()" has already been initialized. You cannot pass values the second time you call retryFailed().');
}
return $this->retryFailed;
}
public function __construct(array $config = [])
{
if (array_key_exists('headers', $config)) {
$this->_usedProperties['headers'] = true;
$this->headers = $config['headers'];
unset($config['headers']);
}
if (array_key_exists('vars', $config)) {
$this->_usedProperties['vars'] = true;
$this->vars = $config['vars'];
unset($config['vars']);
}
if (array_key_exists('max_redirects', $config)) {
$this->_usedProperties['maxRedirects'] = true;
$this->maxRedirects = $config['max_redirects'];
unset($config['max_redirects']);
}
if (array_key_exists('http_version', $config)) {
$this->_usedProperties['httpVersion'] = true;
$this->httpVersion = $config['http_version'];
unset($config['http_version']);
}
if (array_key_exists('resolve', $config)) {
$this->_usedProperties['resolve'] = true;
$this->resolve = $config['resolve'];
unset($config['resolve']);
}
if (array_key_exists('proxy', $config)) {
$this->_usedProperties['proxy'] = true;
$this->proxy = $config['proxy'];
unset($config['proxy']);
}
if (array_key_exists('no_proxy', $config)) {
$this->_usedProperties['noProxy'] = true;
$this->noProxy = $config['no_proxy'];
unset($config['no_proxy']);
}
if (array_key_exists('timeout', $config)) {
$this->_usedProperties['timeout'] = true;
$this->timeout = $config['timeout'];
unset($config['timeout']);
}
if (array_key_exists('max_duration', $config)) {
$this->_usedProperties['maxDuration'] = true;
$this->maxDuration = $config['max_duration'];
unset($config['max_duration']);
}
if (array_key_exists('bindto', $config)) {
$this->_usedProperties['bindto'] = true;
$this->bindto = $config['bindto'];
unset($config['bindto']);
}
if (array_key_exists('verify_peer', $config)) {
$this->_usedProperties['verifyPeer'] = true;
$this->verifyPeer = $config['verify_peer'];
unset($config['verify_peer']);
}
if (array_key_exists('verify_host', $config)) {
$this->_usedProperties['verifyHost'] = true;
$this->verifyHost = $config['verify_host'];
unset($config['verify_host']);
}
if (array_key_exists('cafile', $config)) {
$this->_usedProperties['cafile'] = true;
$this->cafile = $config['cafile'];
unset($config['cafile']);
}
if (array_key_exists('capath', $config)) {
$this->_usedProperties['capath'] = true;
$this->capath = $config['capath'];
unset($config['capath']);
}
if (array_key_exists('local_cert', $config)) {
$this->_usedProperties['localCert'] = true;
$this->localCert = $config['local_cert'];
unset($config['local_cert']);
}
if (array_key_exists('local_pk', $config)) {
$this->_usedProperties['localPk'] = true;
$this->localPk = $config['local_pk'];
unset($config['local_pk']);
}
if (array_key_exists('passphrase', $config)) {
$this->_usedProperties['passphrase'] = true;
$this->passphrase = $config['passphrase'];
unset($config['passphrase']);
}
if (array_key_exists('ciphers', $config)) {
$this->_usedProperties['ciphers'] = true;
$this->ciphers = $config['ciphers'];
unset($config['ciphers']);
}
if (array_key_exists('peer_fingerprint', $config)) {
$this->_usedProperties['peerFingerprint'] = true;
$this->peerFingerprint = new \Symfony\Config\Framework\HttpClient\DefaultOptions\PeerFingerprintConfig($config['peer_fingerprint']);
unset($config['peer_fingerprint']);
}
if (array_key_exists('crypto_method', $config)) {
$this->_usedProperties['cryptoMethod'] = true;
$this->cryptoMethod = $config['crypto_method'];
unset($config['crypto_method']);
}
if (array_key_exists('extra', $config)) {
$this->_usedProperties['extra'] = true;
$this->extra = $config['extra'];
unset($config['extra']);
}
if (array_key_exists('rate_limiter', $config)) {
$this->_usedProperties['rateLimiter'] = true;
$this->rateLimiter = $config['rate_limiter'];
unset($config['rate_limiter']);
}
if (array_key_exists('caching', $config)) {
$this->_usedProperties['caching'] = true;
$this->caching = \is_array($config['caching']) ? new \Symfony\Config\Framework\HttpClient\DefaultOptions\CachingConfig($config['caching']) : $config['caching'];
unset($config['caching']);
}
if (array_key_exists('retry_failed', $config)) {
$this->_usedProperties['retryFailed'] = true;
$this->retryFailed = \is_array($config['retry_failed']) ? new \Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailedConfig($config['retry_failed']) : $config['retry_failed'];
unset($config['retry_failed']);
}
if ($config) {
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($config)));
}
}
public function toArray(): array
{
$output = [];
if (isset($this->_usedProperties['headers'])) {
$output['headers'] = $this->headers;
}
if (isset($this->_usedProperties['vars'])) {
$output['vars'] = $this->vars;
}
if (isset($this->_usedProperties['maxRedirects'])) {
$output['max_redirects'] = $this->maxRedirects;
}
if (isset($this->_usedProperties['httpVersion'])) {
$output['http_version'] = $this->httpVersion;
}
if (isset($this->_usedProperties['resolve'])) {
$output['resolve'] = $this->resolve;
}
if (isset($this->_usedProperties['proxy'])) {
$output['proxy'] = $this->proxy;
}
if (isset($this->_usedProperties['noProxy'])) {
$output['no_proxy'] = $this->noProxy;
}
if (isset($this->_usedProperties['timeout'])) {
$output['timeout'] = $this->timeout;
}
if (isset($this->_usedProperties['maxDuration'])) {
$output['max_duration'] = $this->maxDuration;
}
if (isset($this->_usedProperties['bindto'])) {
$output['bindto'] = $this->bindto;
}
if (isset($this->_usedProperties['verifyPeer'])) {
$output['verify_peer'] = $this->verifyPeer;
}
if (isset($this->_usedProperties['verifyHost'])) {
$output['verify_host'] = $this->verifyHost;
}
if (isset($this->_usedProperties['cafile'])) {
$output['cafile'] = $this->cafile;
}
if (isset($this->_usedProperties['capath'])) {
$output['capath'] = $this->capath;
}
if (isset($this->_usedProperties['localCert'])) {
$output['local_cert'] = $this->localCert;
}
if (isset($this->_usedProperties['localPk'])) {
$output['local_pk'] = $this->localPk;
}
if (isset($this->_usedProperties['passphrase'])) {
$output['passphrase'] = $this->passphrase;
}
if (isset($this->_usedProperties['ciphers'])) {
$output['ciphers'] = $this->ciphers;
}
if (isset($this->_usedProperties['peerFingerprint'])) {
$output['peer_fingerprint'] = $this->peerFingerprint->toArray();
}
if (isset($this->_usedProperties['cryptoMethod'])) {
$output['crypto_method'] = $this->cryptoMethod;
}
if (isset($this->_usedProperties['extra'])) {
$output['extra'] = $this->extra;
}
if (isset($this->_usedProperties['rateLimiter'])) {
$output['rate_limiter'] = $this->rateLimiter;
}
if (isset($this->_usedProperties['caching'])) {
$output['caching'] = $this->caching instanceof \Symfony\Config\Framework\HttpClient\DefaultOptions\CachingConfig ? $this->caching->toArray() : $this->caching;
}
if (isset($this->_usedProperties['retryFailed'])) {
$output['retry_failed'] = $this->retryFailed instanceof \Symfony\Config\Framework\HttpClient\DefaultOptions\RetryFailedConfig ? $this->retryFailed->toArray() : $this->retryFailed;
}
return $output;
}
}

View File

@@ -0,0 +1,743 @@
<?php
namespace Symfony\Config\Framework\HttpClient;
require_once __DIR__.\DIRECTORY_SEPARATOR.'ScopedClientConfig'.\DIRECTORY_SEPARATOR.'PeerFingerprintConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'ScopedClientConfig'.\DIRECTORY_SEPARATOR.'CachingConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'ScopedClientConfig'.\DIRECTORY_SEPARATOR.'RetryFailedConfig.php';
use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* This class is automatically generated to help in creating a config.
*/
class ScopedClientConfig
{
private $scope;
private $baseUri;
private $authBasic;
private $authBearer;
private $authNtlm;
private $query;
private $headers;
private $maxRedirects;
private $httpVersion;
private $resolve;
private $proxy;
private $noProxy;
private $timeout;
private $maxDuration;
private $bindto;
private $verifyPeer;
private $verifyHost;
private $cafile;
private $capath;
private $localCert;
private $localPk;
private $passphrase;
private $ciphers;
private $peerFingerprint;
private $cryptoMethod;
private $extra;
private $rateLimiter;
private $caching;
private $retryFailed;
private $_usedProperties = [];
/**
* The regular expression that the request URL must match before adding the other options. When none is provided, the base URI is used instead.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function scope($value): static
{
$this->_usedProperties['scope'] = true;
$this->scope = $value;
return $this;
}
/**
* The URI to resolve relative URLs, following rules in RFC 3985, section 2.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function baseUri($value): static
{
$this->_usedProperties['baseUri'] = true;
$this->baseUri = $value;
return $this;
}
/**
* An HTTP Basic authentication "username:password".
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function authBasic($value): static
{
$this->_usedProperties['authBasic'] = true;
$this->authBasic = $value;
return $this;
}
/**
* A token enabling HTTP Bearer authorization.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function authBearer($value): static
{
$this->_usedProperties['authBearer'] = true;
$this->authBearer = $value;
return $this;
}
/**
* A "username:password" pair to use Microsoft NTLM authentication (requires the cURL extension).
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function authNtlm($value): static
{
$this->_usedProperties['authNtlm'] = true;
$this->authNtlm = $value;
return $this;
}
/**
* @return $this
*/
public function query(string $key, mixed $value): static
{
$this->_usedProperties['query'] = true;
$this->query[$key] = $value;
return $this;
}
/**
* @return $this
*/
public function header(string $name, mixed $value): static
{
$this->_usedProperties['headers'] = true;
$this->headers[$name] = $value;
return $this;
}
/**
* The maximum number of redirects to follow.
* @default null
* @param ParamConfigurator|int $value
* @return $this
*/
public function maxRedirects($value): static
{
$this->_usedProperties['maxRedirects'] = true;
$this->maxRedirects = $value;
return $this;
}
/**
* The default HTTP version, typically 1.1 or 2.0, leave to null for the best version.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function httpVersion($value): static
{
$this->_usedProperties['httpVersion'] = true;
$this->httpVersion = $value;
return $this;
}
/**
* @return $this
*/
public function resolve(string $host, mixed $value): static
{
$this->_usedProperties['resolve'] = true;
$this->resolve[$host] = $value;
return $this;
}
/**
* The URL of the proxy to pass requests through or null for automatic detection.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function proxy($value): static
{
$this->_usedProperties['proxy'] = true;
$this->proxy = $value;
return $this;
}
/**
* A comma separated list of hosts that do not require a proxy to be reached.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function noProxy($value): static
{
$this->_usedProperties['noProxy'] = true;
$this->noProxy = $value;
return $this;
}
/**
* The idle timeout, defaults to the "default_socket_timeout" ini parameter.
* @default null
* @param ParamConfigurator|float $value
* @return $this
*/
public function timeout($value): static
{
$this->_usedProperties['timeout'] = true;
$this->timeout = $value;
return $this;
}
/**
* The maximum execution time for the request+response as a whole.
* @default null
* @param ParamConfigurator|float $value
* @return $this
*/
public function maxDuration($value): static
{
$this->_usedProperties['maxDuration'] = true;
$this->maxDuration = $value;
return $this;
}
/**
* A network interface name, IP address, a host name or a UNIX socket to bind to.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function bindto($value): static
{
$this->_usedProperties['bindto'] = true;
$this->bindto = $value;
return $this;
}
/**
* Indicates if the peer should be verified in a TLS context.
* @default null
* @param ParamConfigurator|bool $value
* @return $this
*/
public function verifyPeer($value): static
{
$this->_usedProperties['verifyPeer'] = true;
$this->verifyPeer = $value;
return $this;
}
/**
* Indicates if the host should exist as a certificate common name.
* @default null
* @param ParamConfigurator|bool $value
* @return $this
*/
public function verifyHost($value): static
{
$this->_usedProperties['verifyHost'] = true;
$this->verifyHost = $value;
return $this;
}
/**
* A certificate authority file.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function cafile($value): static
{
$this->_usedProperties['cafile'] = true;
$this->cafile = $value;
return $this;
}
/**
* A directory that contains multiple certificate authority files.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function capath($value): static
{
$this->_usedProperties['capath'] = true;
$this->capath = $value;
return $this;
}
/**
* A PEM formatted certificate file.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function localCert($value): static
{
$this->_usedProperties['localCert'] = true;
$this->localCert = $value;
return $this;
}
/**
* A private key file.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function localPk($value): static
{
$this->_usedProperties['localPk'] = true;
$this->localPk = $value;
return $this;
}
/**
* The passphrase used to encrypt the "local_pk" file.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function passphrase($value): static
{
$this->_usedProperties['passphrase'] = true;
$this->passphrase = $value;
return $this;
}
/**
* A list of TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...).
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function ciphers($value): static
{
$this->_usedProperties['ciphers'] = true;
$this->ciphers = $value;
return $this;
}
/**
* Associative array: hashing algorithm => hash(es).
*/
public function peerFingerprint(array $value = []): \Symfony\Config\Framework\HttpClient\ScopedClientConfig\PeerFingerprintConfig
{
if (null === $this->peerFingerprint) {
$this->_usedProperties['peerFingerprint'] = true;
$this->peerFingerprint = new \Symfony\Config\Framework\HttpClient\ScopedClientConfig\PeerFingerprintConfig($value);
} elseif (0 < \func_num_args()) {
throw new InvalidConfigurationException('The node created by "peerFingerprint()" has already been initialized. You cannot pass values the second time you call peerFingerprint().');
}
return $this->peerFingerprint;
}
/**
* The minimum version of TLS to accept; must be one of STREAM_CRYPTO_METHOD_TLSv*_CLIENT constants.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function cryptoMethod($value): static
{
$this->_usedProperties['cryptoMethod'] = true;
$this->cryptoMethod = $value;
return $this;
}
/**
* @return $this
*/
public function extra(string $name, mixed $value): static
{
$this->_usedProperties['extra'] = true;
$this->extra[$name] = $value;
return $this;
}
/**
* Rate limiter name to use for throttling requests.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function rateLimiter($value): static
{
$this->_usedProperties['rateLimiter'] = true;
$this->rateLimiter = $value;
return $this;
}
/**
* @template TValue of array|bool
* @param TValue $value
* Caching configuration.
* @default {"enabled":false,"cache_pool":"cache.http_client","shared":true,"max_ttl":null}
* @return \Symfony\Config\Framework\HttpClient\ScopedClientConfig\CachingConfig|$this
* @psalm-return (TValue is array ? \Symfony\Config\Framework\HttpClient\ScopedClientConfig\CachingConfig : static)
*/
public function caching(array|bool $value = []): \Symfony\Config\Framework\HttpClient\ScopedClientConfig\CachingConfig|static
{
if (!\is_array($value)) {
$this->_usedProperties['caching'] = true;
$this->caching = $value;
return $this;
}
if (!$this->caching instanceof \Symfony\Config\Framework\HttpClient\ScopedClientConfig\CachingConfig) {
$this->_usedProperties['caching'] = true;
$this->caching = new \Symfony\Config\Framework\HttpClient\ScopedClientConfig\CachingConfig($value);
} elseif (0 < \func_num_args()) {
throw new InvalidConfigurationException('The node created by "caching()" has already been initialized. You cannot pass values the second time you call caching().');
}
return $this->caching;
}
/**
* @template TValue of array|bool
* @param TValue $value
* @default {"enabled":false,"retry_strategy":null,"http_codes":[],"max_retries":3,"delay":1000,"multiplier":2,"max_delay":0,"jitter":0.1}
* @return \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailedConfig|$this
* @psalm-return (TValue is array ? \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailedConfig : static)
*/
public function retryFailed(array|bool $value = []): \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailedConfig|static
{
if (!\is_array($value)) {
$this->_usedProperties['retryFailed'] = true;
$this->retryFailed = $value;
return $this;
}
if (!$this->retryFailed instanceof \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailedConfig) {
$this->_usedProperties['retryFailed'] = true;
$this->retryFailed = new \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailedConfig($value);
} elseif (0 < \func_num_args()) {
throw new InvalidConfigurationException('The node created by "retryFailed()" has already been initialized. You cannot pass values the second time you call retryFailed().');
}
return $this->retryFailed;
}
public function __construct(array $config = [])
{
if (array_key_exists('scope', $config)) {
$this->_usedProperties['scope'] = true;
$this->scope = $config['scope'];
unset($config['scope']);
}
if (array_key_exists('base_uri', $config)) {
$this->_usedProperties['baseUri'] = true;
$this->baseUri = $config['base_uri'];
unset($config['base_uri']);
}
if (array_key_exists('auth_basic', $config)) {
$this->_usedProperties['authBasic'] = true;
$this->authBasic = $config['auth_basic'];
unset($config['auth_basic']);
}
if (array_key_exists('auth_bearer', $config)) {
$this->_usedProperties['authBearer'] = true;
$this->authBearer = $config['auth_bearer'];
unset($config['auth_bearer']);
}
if (array_key_exists('auth_ntlm', $config)) {
$this->_usedProperties['authNtlm'] = true;
$this->authNtlm = $config['auth_ntlm'];
unset($config['auth_ntlm']);
}
if (array_key_exists('query', $config)) {
$this->_usedProperties['query'] = true;
$this->query = $config['query'];
unset($config['query']);
}
if (array_key_exists('headers', $config)) {
$this->_usedProperties['headers'] = true;
$this->headers = $config['headers'];
unset($config['headers']);
}
if (array_key_exists('max_redirects', $config)) {
$this->_usedProperties['maxRedirects'] = true;
$this->maxRedirects = $config['max_redirects'];
unset($config['max_redirects']);
}
if (array_key_exists('http_version', $config)) {
$this->_usedProperties['httpVersion'] = true;
$this->httpVersion = $config['http_version'];
unset($config['http_version']);
}
if (array_key_exists('resolve', $config)) {
$this->_usedProperties['resolve'] = true;
$this->resolve = $config['resolve'];
unset($config['resolve']);
}
if (array_key_exists('proxy', $config)) {
$this->_usedProperties['proxy'] = true;
$this->proxy = $config['proxy'];
unset($config['proxy']);
}
if (array_key_exists('no_proxy', $config)) {
$this->_usedProperties['noProxy'] = true;
$this->noProxy = $config['no_proxy'];
unset($config['no_proxy']);
}
if (array_key_exists('timeout', $config)) {
$this->_usedProperties['timeout'] = true;
$this->timeout = $config['timeout'];
unset($config['timeout']);
}
if (array_key_exists('max_duration', $config)) {
$this->_usedProperties['maxDuration'] = true;
$this->maxDuration = $config['max_duration'];
unset($config['max_duration']);
}
if (array_key_exists('bindto', $config)) {
$this->_usedProperties['bindto'] = true;
$this->bindto = $config['bindto'];
unset($config['bindto']);
}
if (array_key_exists('verify_peer', $config)) {
$this->_usedProperties['verifyPeer'] = true;
$this->verifyPeer = $config['verify_peer'];
unset($config['verify_peer']);
}
if (array_key_exists('verify_host', $config)) {
$this->_usedProperties['verifyHost'] = true;
$this->verifyHost = $config['verify_host'];
unset($config['verify_host']);
}
if (array_key_exists('cafile', $config)) {
$this->_usedProperties['cafile'] = true;
$this->cafile = $config['cafile'];
unset($config['cafile']);
}
if (array_key_exists('capath', $config)) {
$this->_usedProperties['capath'] = true;
$this->capath = $config['capath'];
unset($config['capath']);
}
if (array_key_exists('local_cert', $config)) {
$this->_usedProperties['localCert'] = true;
$this->localCert = $config['local_cert'];
unset($config['local_cert']);
}
if (array_key_exists('local_pk', $config)) {
$this->_usedProperties['localPk'] = true;
$this->localPk = $config['local_pk'];
unset($config['local_pk']);
}
if (array_key_exists('passphrase', $config)) {
$this->_usedProperties['passphrase'] = true;
$this->passphrase = $config['passphrase'];
unset($config['passphrase']);
}
if (array_key_exists('ciphers', $config)) {
$this->_usedProperties['ciphers'] = true;
$this->ciphers = $config['ciphers'];
unset($config['ciphers']);
}
if (array_key_exists('peer_fingerprint', $config)) {
$this->_usedProperties['peerFingerprint'] = true;
$this->peerFingerprint = new \Symfony\Config\Framework\HttpClient\ScopedClientConfig\PeerFingerprintConfig($config['peer_fingerprint']);
unset($config['peer_fingerprint']);
}
if (array_key_exists('crypto_method', $config)) {
$this->_usedProperties['cryptoMethod'] = true;
$this->cryptoMethod = $config['crypto_method'];
unset($config['crypto_method']);
}
if (array_key_exists('extra', $config)) {
$this->_usedProperties['extra'] = true;
$this->extra = $config['extra'];
unset($config['extra']);
}
if (array_key_exists('rate_limiter', $config)) {
$this->_usedProperties['rateLimiter'] = true;
$this->rateLimiter = $config['rate_limiter'];
unset($config['rate_limiter']);
}
if (array_key_exists('caching', $config)) {
$this->_usedProperties['caching'] = true;
$this->caching = \is_array($config['caching']) ? new \Symfony\Config\Framework\HttpClient\ScopedClientConfig\CachingConfig($config['caching']) : $config['caching'];
unset($config['caching']);
}
if (array_key_exists('retry_failed', $config)) {
$this->_usedProperties['retryFailed'] = true;
$this->retryFailed = \is_array($config['retry_failed']) ? new \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailedConfig($config['retry_failed']) : $config['retry_failed'];
unset($config['retry_failed']);
}
if ($config) {
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($config)));
}
}
public function toArray(): array
{
$output = [];
if (isset($this->_usedProperties['scope'])) {
$output['scope'] = $this->scope;
}
if (isset($this->_usedProperties['baseUri'])) {
$output['base_uri'] = $this->baseUri;
}
if (isset($this->_usedProperties['authBasic'])) {
$output['auth_basic'] = $this->authBasic;
}
if (isset($this->_usedProperties['authBearer'])) {
$output['auth_bearer'] = $this->authBearer;
}
if (isset($this->_usedProperties['authNtlm'])) {
$output['auth_ntlm'] = $this->authNtlm;
}
if (isset($this->_usedProperties['query'])) {
$output['query'] = $this->query;
}
if (isset($this->_usedProperties['headers'])) {
$output['headers'] = $this->headers;
}
if (isset($this->_usedProperties['maxRedirects'])) {
$output['max_redirects'] = $this->maxRedirects;
}
if (isset($this->_usedProperties['httpVersion'])) {
$output['http_version'] = $this->httpVersion;
}
if (isset($this->_usedProperties['resolve'])) {
$output['resolve'] = $this->resolve;
}
if (isset($this->_usedProperties['proxy'])) {
$output['proxy'] = $this->proxy;
}
if (isset($this->_usedProperties['noProxy'])) {
$output['no_proxy'] = $this->noProxy;
}
if (isset($this->_usedProperties['timeout'])) {
$output['timeout'] = $this->timeout;
}
if (isset($this->_usedProperties['maxDuration'])) {
$output['max_duration'] = $this->maxDuration;
}
if (isset($this->_usedProperties['bindto'])) {
$output['bindto'] = $this->bindto;
}
if (isset($this->_usedProperties['verifyPeer'])) {
$output['verify_peer'] = $this->verifyPeer;
}
if (isset($this->_usedProperties['verifyHost'])) {
$output['verify_host'] = $this->verifyHost;
}
if (isset($this->_usedProperties['cafile'])) {
$output['cafile'] = $this->cafile;
}
if (isset($this->_usedProperties['capath'])) {
$output['capath'] = $this->capath;
}
if (isset($this->_usedProperties['localCert'])) {
$output['local_cert'] = $this->localCert;
}
if (isset($this->_usedProperties['localPk'])) {
$output['local_pk'] = $this->localPk;
}
if (isset($this->_usedProperties['passphrase'])) {
$output['passphrase'] = $this->passphrase;
}
if (isset($this->_usedProperties['ciphers'])) {
$output['ciphers'] = $this->ciphers;
}
if (isset($this->_usedProperties['peerFingerprint'])) {
$output['peer_fingerprint'] = $this->peerFingerprint->toArray();
}
if (isset($this->_usedProperties['cryptoMethod'])) {
$output['crypto_method'] = $this->cryptoMethod;
}
if (isset($this->_usedProperties['extra'])) {
$output['extra'] = $this->extra;
}
if (isset($this->_usedProperties['rateLimiter'])) {
$output['rate_limiter'] = $this->rateLimiter;
}
if (isset($this->_usedProperties['caching'])) {
$output['caching'] = $this->caching instanceof \Symfony\Config\Framework\HttpClient\ScopedClientConfig\CachingConfig ? $this->caching->toArray() : $this->caching;
}
if (isset($this->_usedProperties['retryFailed'])) {
$output['retry_failed'] = $this->retryFailed instanceof \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailedConfig ? $this->retryFailed->toArray() : $this->retryFailed;
}
return $output;
}
}

View File

@@ -0,0 +1,124 @@
<?php
namespace Symfony\Config\Framework\HttpClient\ScopedClientConfig;
use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* This class is automatically generated to help in creating a config.
*/
class CachingConfig
{
private $enabled;
private $cachePool;
private $shared;
private $maxTtl;
private $_usedProperties = [];
/**
* @default false
* @param ParamConfigurator|bool $value
* @return $this
*/
public function enabled($value): static
{
$this->_usedProperties['enabled'] = true;
$this->enabled = $value;
return $this;
}
/**
* The taggable cache pool to use for storing the responses.
* @default 'cache.http_client'
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function cachePool($value): static
{
$this->_usedProperties['cachePool'] = true;
$this->cachePool = $value;
return $this;
}
/**
* Indicates whether the cache is shared (public) or private.
* @default true
* @param ParamConfigurator|bool $value
* @return $this
*/
public function shared($value): static
{
$this->_usedProperties['shared'] = true;
$this->shared = $value;
return $this;
}
/**
* The maximum TTL (in seconds) allowed for cached responses. Null means no cap.
* @default null
* @param ParamConfigurator|int $value
* @return $this
*/
public function maxTtl($value): static
{
$this->_usedProperties['maxTtl'] = true;
$this->maxTtl = $value;
return $this;
}
public function __construct(array $config = [])
{
if (array_key_exists('enabled', $config)) {
$this->_usedProperties['enabled'] = true;
$this->enabled = $config['enabled'];
unset($config['enabled']);
}
if (array_key_exists('cache_pool', $config)) {
$this->_usedProperties['cachePool'] = true;
$this->cachePool = $config['cache_pool'];
unset($config['cache_pool']);
}
if (array_key_exists('shared', $config)) {
$this->_usedProperties['shared'] = true;
$this->shared = $config['shared'];
unset($config['shared']);
}
if (array_key_exists('max_ttl', $config)) {
$this->_usedProperties['maxTtl'] = true;
$this->maxTtl = $config['max_ttl'];
unset($config['max_ttl']);
}
if ($config) {
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($config)));
}
}
public function toArray(): array
{
$output = [];
if (isset($this->_usedProperties['enabled'])) {
$output['enabled'] = $this->enabled;
}
if (isset($this->_usedProperties['cachePool'])) {
$output['cache_pool'] = $this->cachePool;
}
if (isset($this->_usedProperties['shared'])) {
$output['shared'] = $this->shared;
}
if (isset($this->_usedProperties['maxTtl'])) {
$output['max_ttl'] = $this->maxTtl;
}
return $output;
}
}

View File

@@ -0,0 +1,101 @@
<?php
namespace Symfony\Config\Framework\HttpClient\ScopedClientConfig;
use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* This class is automatically generated to help in creating a config.
*/
class PeerFingerprintConfig
{
private $sha1;
private $pinsha256;
private $md5;
private $_usedProperties = [];
/**
* @default null
* @param ParamConfigurator|mixed $value
*
* @return $this
*/
public function sha1(mixed $value): static
{
$this->_usedProperties['sha1'] = true;
$this->sha1 = $value;
return $this;
}
/**
* @default null
* @param ParamConfigurator|mixed $value
*
* @return $this
*/
public function pinsha256(mixed $value): static
{
$this->_usedProperties['pinsha256'] = true;
$this->pinsha256 = $value;
return $this;
}
/**
* @default null
* @param ParamConfigurator|mixed $value
*
* @return $this
*/
public function md5(mixed $value): static
{
$this->_usedProperties['md5'] = true;
$this->md5 = $value;
return $this;
}
public function __construct(array $config = [])
{
if (array_key_exists('sha1', $config)) {
$this->_usedProperties['sha1'] = true;
$this->sha1 = $config['sha1'];
unset($config['sha1']);
}
if (array_key_exists('pin-sha256', $config)) {
$this->_usedProperties['pinsha256'] = true;
$this->pinsha256 = $config['pin-sha256'];
unset($config['pin-sha256']);
}
if (array_key_exists('md5', $config)) {
$this->_usedProperties['md5'] = true;
$this->md5 = $config['md5'];
unset($config['md5']);
}
if ($config) {
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($config)));
}
}
public function toArray(): array
{
$output = [];
if (isset($this->_usedProperties['sha1'])) {
$output['sha1'] = $this->sha1;
}
if (isset($this->_usedProperties['pinsha256'])) {
$output['pin-sha256'] = $this->pinsha256;
}
if (isset($this->_usedProperties['md5'])) {
$output['md5'] = $this->md5;
}
return $output;
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailed;
use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* This class is automatically generated to help in creating a config.
*/
class HttpCodeConfig
{
private $code;
private $methods;
private $_usedProperties = [];
/**
* @default null
* @param ParamConfigurator|int $value
* @return $this
*/
public function code($value): static
{
$this->_usedProperties['code'] = true;
$this->code = $value;
return $this;
}
/**
* @param ParamConfigurator|list<ParamConfigurator|mixed>|string $value
*
* @return $this
*/
public function methods(ParamConfigurator|string|array $value): static
{
$this->_usedProperties['methods'] = true;
$this->methods = $value;
return $this;
}
public function __construct(array $config = [])
{
if (array_key_exists('code', $config)) {
$this->_usedProperties['code'] = true;
$this->code = $config['code'];
unset($config['code']);
}
if (array_key_exists('methods', $config)) {
$this->_usedProperties['methods'] = true;
$this->methods = $config['methods'];
unset($config['methods']);
}
if ($config) {
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($config)));
}
}
public function toArray(): array
{
$output = [];
if (isset($this->_usedProperties['code'])) {
$output['code'] = $this->code;
}
if (isset($this->_usedProperties['methods'])) {
$output['methods'] = $this->methods;
}
return $output;
}
}

View File

@@ -0,0 +1,222 @@
<?php
namespace Symfony\Config\Framework\HttpClient\ScopedClientConfig;
require_once __DIR__.\DIRECTORY_SEPARATOR.'RetryFailed'.\DIRECTORY_SEPARATOR.'HttpCodeConfig.php';
use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* This class is automatically generated to help in creating a config.
*/
class RetryFailedConfig
{
private $enabled;
private $retryStrategy;
private $httpCodes;
private $maxRetries;
private $delay;
private $multiplier;
private $maxDelay;
private $jitter;
private $_usedProperties = [];
/**
* @default false
* @param ParamConfigurator|bool $value
* @return $this
*/
public function enabled($value): static
{
$this->_usedProperties['enabled'] = true;
$this->enabled = $value;
return $this;
}
/**
* service id to override the retry strategy.
* @default null
* @param ParamConfigurator|mixed $value
* @return $this
*/
public function retryStrategy($value): static
{
$this->_usedProperties['retryStrategy'] = true;
$this->retryStrategy = $value;
return $this;
}
/**
* A list of HTTP status code that triggers a retry.
*/
public function httpCode(string $code, array $value = []): \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailed\HttpCodeConfig
{
if (!isset($this->httpCodes[$code])) {
$this->_usedProperties['httpCodes'] = true;
$this->httpCodes[$code] = new \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailed\HttpCodeConfig($value);
} elseif (1 < \func_num_args()) {
throw new InvalidConfigurationException('The node created by "httpCode()" has already been initialized. You cannot pass values the second time you call httpCode().');
}
return $this->httpCodes[$code];
}
/**
* @default 3
* @param ParamConfigurator|int $value
* @return $this
*/
public function maxRetries($value): static
{
$this->_usedProperties['maxRetries'] = true;
$this->maxRetries = $value;
return $this;
}
/**
* Time in ms to delay (or the initial value when multiplier is used).
* @default 1000
* @param ParamConfigurator|int $value
* @return $this
*/
public function delay($value): static
{
$this->_usedProperties['delay'] = true;
$this->delay = $value;
return $this;
}
/**
* If greater than 1, delay will grow exponentially for each retry: delay * (multiple ^ retries).
* @default 2
* @param ParamConfigurator|float $value
* @return $this
*/
public function multiplier($value): static
{
$this->_usedProperties['multiplier'] = true;
$this->multiplier = $value;
return $this;
}
/**
* Max time in ms that a retry should ever be delayed (0 = infinite).
* @default 0
* @param ParamConfigurator|int $value
* @return $this
*/
public function maxDelay($value): static
{
$this->_usedProperties['maxDelay'] = true;
$this->maxDelay = $value;
return $this;
}
/**
* Randomness in percent (between 0 and 1) to apply to the delay.
* @default 0.1
* @param ParamConfigurator|float $value
* @return $this
*/
public function jitter($value): static
{
$this->_usedProperties['jitter'] = true;
$this->jitter = $value;
return $this;
}
public function __construct(array $config = [])
{
if (array_key_exists('enabled', $config)) {
$this->_usedProperties['enabled'] = true;
$this->enabled = $config['enabled'];
unset($config['enabled']);
}
if (array_key_exists('retry_strategy', $config)) {
$this->_usedProperties['retryStrategy'] = true;
$this->retryStrategy = $config['retry_strategy'];
unset($config['retry_strategy']);
}
if (array_key_exists('http_codes', $config)) {
$this->_usedProperties['httpCodes'] = true;
$this->httpCodes = array_map(fn ($v) => \is_array($v) ? new \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailed\HttpCodeConfig($v) : $v, $config['http_codes']);
unset($config['http_codes']);
}
if (array_key_exists('max_retries', $config)) {
$this->_usedProperties['maxRetries'] = true;
$this->maxRetries = $config['max_retries'];
unset($config['max_retries']);
}
if (array_key_exists('delay', $config)) {
$this->_usedProperties['delay'] = true;
$this->delay = $config['delay'];
unset($config['delay']);
}
if (array_key_exists('multiplier', $config)) {
$this->_usedProperties['multiplier'] = true;
$this->multiplier = $config['multiplier'];
unset($config['multiplier']);
}
if (array_key_exists('max_delay', $config)) {
$this->_usedProperties['maxDelay'] = true;
$this->maxDelay = $config['max_delay'];
unset($config['max_delay']);
}
if (array_key_exists('jitter', $config)) {
$this->_usedProperties['jitter'] = true;
$this->jitter = $config['jitter'];
unset($config['jitter']);
}
if ($config) {
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($config)));
}
}
public function toArray(): array
{
$output = [];
if (isset($this->_usedProperties['enabled'])) {
$output['enabled'] = $this->enabled;
}
if (isset($this->_usedProperties['retryStrategy'])) {
$output['retry_strategy'] = $this->retryStrategy;
}
if (isset($this->_usedProperties['httpCodes'])) {
$output['http_codes'] = array_map(fn ($v) => $v instanceof \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailed\HttpCodeConfig ? $v->toArray() : $v, $this->httpCodes);
}
if (isset($this->_usedProperties['maxRetries'])) {
$output['max_retries'] = $this->maxRetries;
}
if (isset($this->_usedProperties['delay'])) {
$output['delay'] = $this->delay;
}
if (isset($this->_usedProperties['multiplier'])) {
$output['multiplier'] = $this->multiplier;
}
if (isset($this->_usedProperties['maxDelay'])) {
$output['max_delay'] = $this->maxDelay;
}
if (isset($this->_usedProperties['jitter'])) {
$output['jitter'] = $this->jitter;
}
return $output;
}
}