src/ChrisKonnertz/DeepLy/ResponseBag/AbstractBag.php
public function verifyResponseContent($responseContent)
    {
        if (! $responseContent instanceof \stdClass) {
            throw new BagException('DeepLy API call did not return JSON that describes a \stdClass object', 10);
        }

        if (property_exists($responseContent, 'error')) {
            if ($responseContent->error instanceof \stdClass and property_exists($responseContent->error, 'message')) {
                throw new BagException(
                    'DeepLy API call resulted in this error: '.$responseContent->error->message, 20
                );
            } else {
                throw new BagException('DeepLy API call resulted in an unknown error', 21);
            }
        }
    }
public function verifyResponseContent($responseContent)
    {
        if (! $responseContent instanceof \stdClass) {
            throw new BagException('DeepLy API call did not return JSON that describes a \stdClass object', 10);
        }

        if (property_exists($responseContent, 'error')) {
            if ($responseContent->error instanceof \stdClass and property_exists($responseContent->error, 'message')) {
                throw new BagException(
                    'DeepLy API call resulted in this error: '.$responseContent->error->message, 20
                );
            } else {
                throw new BagException('DeepLy API call resulted in an unknown error', 21);
            }
        }
    }
Verifies that the given response content (usually a \stdClass built by json_decode())
is a valid result from an API call to the DeepL API.
This method will not return true/false but throw an exception if something is invalid.

@param mixed|null $responseContent The response content (payload) of a split text API call
@throws BagException
@return void