Retrieves a callable for a given PHP AI Client SDK prompt builder method name.
Parameters
$namestringrequired- The method name in snake_case.
Source
protected function get_builder_callable( string $name ): callable {
$camel_case_name = $this->snake_to_camel_case( $name );
$method = array( $this->builder, $camel_case_name );
if ( ! is_callable( $method ) ) {
throw new BadMethodCallException(
sprintf(
/* translators: 1: Method name. 2: Class name. */
__( 'Method %1$s does not exist on %2$s.' ),
$name, // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
get_class( $this->builder ) // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
)
);
}
return $method;
}
Changelog
| Version | Description |
|---|---|
| 7.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.