Automattic\WooCommerce\Internal\Abilities\REST

RestAbilityFactory::get_http_method_for_operation │ private static │ WC 1.0

Get HTTP method for a given operation type.

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

Хуков нет.

Возвращает

string. HTTP method (GET, POST, PUT, DELETE).

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

$result = RestAbilityFactory::get_http_method_for_operation( $operation ): string;
$operation(строка) (обязательный)
Operation type (list, get, create, update, delete).

Код RestAbilityFactory::get_http_method_for_operation() WC 11.2.2

private static function get_http_method_for_operation( string $operation ): string {
	$method_map = array(
		'list'   => 'GET',
		'get'    => 'GET',
		'create' => 'POST',
		'update' => 'PUT',
		'delete' => 'DELETE',
	);
	return $method_map[ $operation ] ?? 'GET';
}