WordPress\AiClient\Providers\Http\DTO

RequestOptions::validateTimeoutprivateWP 0.2.0

Validates timeout values.

Method of the class: RequestOptions{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->validateTimeout( ?float $value, $fieldName ): void;
?float $value(required)
.
$fieldName(string) (required)
Field name for the error message.

Changelog

Since 0.2.0 Introduced.

RequestOptions::validateTimeout() code WP 7.0

private function validateTimeout(?float $value, string $fieldName): void
{
    if ($value !== null && $value < 0) {
        throw new InvalidArgumentException(sprintf('Request option "%s" must be greater than or equal to 0.', $fieldName));
    }
}