Automattic\WooCommerce\Internal\Abilities\REST

RestAbilityFactory::get_http_method_for_operationprivate staticWC 1.0

Get HTTP method for a given operation type.

Method of the class: RestAbilityFactory{}

No Hooks.

Returns

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

Usage

$result = RestAbilityFactory::get_http_method_for_operation( $operation ): string;
$operation(string) (required)
Operation type (list, get, create, update, delete).

RestAbilityFactory::get_http_method_for_operation() code WC 10.7.0

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';
}