WP_AI_Client_Prompt_Builder::get_builder_callable
Retrieves a callable for a given PHP AI Client SDK prompt builder method name.
Метод класса: WP_AI_Client_Prompt_Builder{}
Хуков нет.
Возвращает
callable. The callable for the specified method.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_builder_callable( $name ): callable;
- $name(строка) (обязательный)
- The method name in snake_case.
Список изменений
| С версии 7.0.0 | Введена. |
Код WP_AI_Client_Prompt_Builder::get_builder_callable() WP AI Client Prompt Builder::get builder callable WP 7.0
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;
}