Automattic\WooCommerce\Vendor\GraphQL\Server

Helper::assertJsonObjectOrArray │ protected │ WC 1.0

Method of the class: Helper{}

No Hooks.

Returns

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->assertJsonObjectOrArray( $bodyParams ): void;
$bodyParams(mixed) (required)
.

Helper::assertJsonObjectOrArray() code WC 11.1.2

protected function assertJsonObjectOrArray($bodyParams): void
{
    if (! is_array($bodyParams)) {
        $notArray = Utils::printSafeJson($bodyParams);
        throw new CannotParseJsonBody("Expected JSON object or array for \"application/json\" request, got: {$notArray}");
    }
}