Request_Api::has_proper_response_body( TribeEventsVirtualIntegrationsarray $body, TribeEventsVirtualIntegrationsarray $additional_checks = array() )

Check if a response body has proper attributes.


Parameters

$body

(<span class="TribeEventsVirtualIntegrationsarrayTribeEventsVirtualIntegrationsarray<string|">TribeEventsVirtualIntegrationsmixed>) (Required) A response body array.

$additional_checks

(<span class="TribeEventsVirtualIntegrationsarrayTribeEventsVirtualIntegrationsarray<string|">TribeEventsVirtualIntegrationsstring>) (Optional) An array of keys to check for in the body array.

Default value: array()


Top ↑

Return

(boolean) Whether the response body has the proper attributes.


Top ↑

Source

File: src/Tribe/Integrations/Request_Api.php

	public static function has_proper_response_body( $body, $additional_checks = [] ) {
		if ( empty( $body ) || ! is_array( $body ) ) {
			return false;
		}

		if ( empty( $additional_checks ) ) {
			return true;
		}

		// Additional array keys to check for in the body response.
		if ( array_diff_key( array_flip( $additional_checks ), $body ) ) {
			return false;
		}

		return true;
	}

Top ↑

Changelog

Changelog
Version Description
1.13.0 Introduced.