Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Webflow
WebflowFetcher::extract_collections_list
Webflow's /collections endpoint sometimes returns a bare array and sometimes an envelope. Normalize to a flat list of collection objects.
Method of the class: WebflowFetcher{}
No Hooks.
Returns
Array.
Usage
// private - for code of main (parent) class only $result = $this->extract_collections_list( $response ): array;
- $response(mixed) (required)
- The raw decoded API response.
WebflowFetcher::extract_collections_list() WebflowFetcher::extract collections list code WC 11.0.1
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();
}