Automattic\WooCommerce\Blocks\AIContent

UpdatePatterns::prepare_expected_results_format()privateWC 1.0

Prepares the expected results format for the AI.

Метод класса: UpdatePatterns{}

Хуков нет.

Возвращает

Массив.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->prepare_expected_results_format( $prompts );
$prompts(массив) (обязательный)
The array of prompts.

Код UpdatePatterns::prepare_expected_results_format() WC 9.4.2

private function prepare_expected_results_format( array $prompts ) {
	$expected_results_format = [];
	foreach ( $prompts as $prompt ) {
		$expected_result_format = [];

		foreach ( $prompt as $key => $values ) {
			$expected_result_format[ $key ] = [];

			foreach ( $values as $sub_key => $sub_value ) {
				$expected_result_format[ $key ][ $sub_key ] = '';
			}
		}

		$expected_results_format[] = $expected_result_format;
	}

	return $expected_results_format;
}