Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Webflow

WebflowFetcher::extract_collections_list │ private │ WC 1.0

Webflow's /collections endpoint sometimes returns a bare array and sometimes an envelope. Normalize to a flat list of collection objects.

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

Хуков нет.

Возвращает

array<int,object>.

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

// private - только в коде основоного (родительского) класса
$result = $this->extract_collections_list( $response ): array;
$response(разное) (обязательный)
The raw decoded API response.

Код WebflowFetcher::extract_collections_list() WC 11.2.2

private function extract_collections_list( $response ): array {
	if ( is_array( $response ) ) {
		return $response;
	}

	if ( is_object( $response ) && isset( $response->collections ) && is_array( $response->collections ) ) {
		return $response->collections;
	}

	return array();
}