Constructor.
Parameters
$idstringrequired- The provider’s unique identifier.
$namestringrequired- The provider’s display name.
$typeWordPressAiClientProvidersEnumsProviderTypeEnumrequired- The provider type.
$credentialsUrlstring|nulloptional- The URL where users can get credentials.
Default:
null $authenticationMethodWordPressAiClientProvidersHttpEnumsRequestAuthenticationMethod|nulloptional- The authentication method.
Default:
null $descriptionstring|nulloptional- The provider’s description.
Default:
null $logoPathstring|nulloptional- The full path to the provider’s logo image file.
Default:
null
Source
public function __construct(string $id, string $name, ProviderTypeEnum $type, ?string $credentialsUrl = null, ?RequestAuthenticationMethod $authenticationMethod = null, ?string $description = null, ?string $logoPath = null)
{
if (!preg_match('/^[a-z0-9\-_]+$/', $id)) {
throw new InvalidArgumentException(sprintf(
// phpcs:ignore Generic.Files.LineLength.TooLong
'Invalid provider ID "%s". Only lowercase alphanumeric characters, hyphens, and underscores are allowed.',
$id
));
}
$this->id = $id;
$this->name = $name;
$this->description = $description;
$this->type = $type;
$this->credentialsUrl = $credentialsUrl;
$this->authenticationMethod = $authenticationMethod;
$this->logoPath = $logoPath;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.