Validates the data responded by the API
Just checks the header status is successful.

@param array $response

@return boolean True if valid
198329
public function validateResponse(array $response)
    {
        $returnValue = false;
        if (isset($response['header'])
            && isset($response['header']['status'])
            && $response['header']['status'] >= 200
            && $response['header']['status'] < 300
        ) {
            $returnValue = true;
        }

        return $returnValue;
    }
1005691
protected function validate_response($response) {

        $response = $this->decode_response($response);

        if (empty($response)) {
            throw new checker_exception('err_response_empty');
        }

        if (empty($response['status']) or $response['status'] !== 'OK') {
            throw new checker_exception('err_response_status', $response['status']);
        }

        if (empty($response['apiver']) or $response['apiver'] !== '1.3') {
            throw new checker_exception('err_response_format_version', $response['apiver']);
        }

        if (empty($response['forbranch']) or $response['forbranch'] !== moodle_major_version(true)) {
            throw new checker_exception('err_response_target_version', $response['forbranch']);
        }
    }
528506
public function checkResponse(array $response)
    {
        $exception = $responses = null;

        if (isset($response['responseCode'])) {
            $responses = explode(',', $response['responseCode']);
        }

        if (isset($response['response_code'])) {
            $responses = explode(',', $response['response_code']);
        }

        if (isset($responses)) {
            foreach ($responses as $code) {
                if (!in_array($code, [100])) {
                    $exception = new LimeLightCRMTransactionException($code, $exception, $response);
                }
            }
        }

        if (isset($exception)) {
            throw $exception;
        }
    }
569866
public function validateHeader(array $header)
    {
        if (!isset($header['alg'])) {
            throw new \InvalidArgumentException("Missing 'alg' in header");
        }
        if (!isset($header['typ'])) {
            throw new \InvalidArgumentException("Missing 'typ' in header");
        }
        if ($this->type !== $header['alg']) {
            throw new \InvalidArgumentException("Algorithm mismatch");
        }
    }
1133405
public function checkResponse($response) {
    if (!is_array($response)) {
      return FALSE;
    }

    $responseParams = array();
    foreach ($this->responseFields as $k => $mandatory) {
      if (isset($response[$k])) {
        $responseParams[$k] = $response[$k];
      }
      elseif (!isset($response[$k]) && $mandatory) {
        throw new \Exception('expected response field ' . $k . ' is missing');
      }
    }

    return $responseParams;
  }
286939
public static function validate($value)
    {
        if (!is_array($value)) {
            return false;
        }
        if (isset($value['from']) && IdentityValidator::validate($value['from']) === false) {
            return false;
        }
        if (isset($value['to']) && IdentityValidator::validate($value['to']) === false) {
            return false;
        }
        if (!isset($value['topics']) || !is_array($value['topics'])) {
            return false;
        }
        foreach ($value['topics'] as $topic) {
            if (IdentityValidator::validate($topic) === false) {
                return false;
            }
        }
        if (!isset($value['payload'])) {
            return false;
        }
        if (HexValidator::validate($value['payload']) === false) {
            return false;
        }
        if (!isset($value['priority'])) {
            return false;
        }
        if (QuantityValidator::validate($value['priority']) === false) {
            return false;
        }
        if (!isset($value['ttl'])) {
            return false;
        }
        if (isset($value['ttl']) && QuantityValidator::validate($value['ttl']) === false) {
            return false;
        }
        return true;
    }
700426
protected function validateServerResponse(Response $response)
    {
        switch ($response->getStatusCode()) {
            case Response::REST_CLIENT_ERROR_UNAUTHORIZED:
                throw new ClientException('You have provided an invalid API key', ClientException::INVALID_APPLICATION_SECRET, $response);
                break;
            case Response::REST_CLIENT_ERROR_FORBIDDEN:
                throw new ClientException('Your account is not enabled for the service', ClientException::INVALID_APPLICATION_SECRET, $response);
                break;
            case Response::REST_CLIENT_ERROR_NOT_FOUND:
                throw new ClientException('The requested entity was not found on the server', ClientException::ENTITY_NOT_FOUND, $response);
                break;
            case Response::REST_CLIENT_ERROR_CONFLICT:
                $body = $response->getBody();

                $message = (isset($body['detail'])) ? $body['detail'] : 'The request was rejected due to an conflict.';
                throw new ClientException($message, ClientException::INVALID_RESPONSE, $response);
                break;
            case Response::REST_CLIENT_ERROR_UNPROCESSABLE_ENTITY:
                $body = $response->getBody();

                $message = (isset($body['detail'])) ? $body['detail'] : 'Unable to process the request';
                throw new ClientException($message, ClientException::INVALID_RESPONSE, $response);
                break;
            case Response::REST_CLIENT_ERROR_LOCKED:
                $body = $response->getBody();

                $message = (isset($body['detail'])) ? $body['detail'] : 'The request could not be processed as the entity was locked.';
                throw new ClientException($message, ClientException::INVALID_RESPONSE, $response);
                break;
            case Response::REST_CLIENT_ERROR_TOO_MANY_REQUESTS:
                throw new ClientException('You are sending too fast and your calls are throttled', ClientException::SERVER_UNAVAILABLE, $response);
                break;
            case Response::REST_CLIENT_ERROR_PAYMENT_REQUIRED:
                throw new ClientException('Insufficient credit for your wallet', ClientException::INSUFFICIENT_CREDIT, $response);
                break;
            case Response::REST_SUCCESS_OK:
            case Response::REST_SUCCESS_CREATED:
                break; // Valid response
            default:
                throw new ClientException(sprintf('Unknown status code %d received from server', $response->getStatusCode()), ClientException::INVALID_RESPONSE, $response);
                break;
        }
    }
116187
private function resolveResponseArray(array $response)
    {
        if ($count = count($response)) {
            if ($count === 1) {
                $response = $response[0];
            }
        }
        $this->firing[] = $response;

        return $response;
    }
684467
private function validateResponse( $response ) {

		// Make sure WordPress errors are handled.
		if ( is_wp_error( $response ) ) {
			$this->error = $response->get_error_message();
			return false;
		}

		// Check for 200 response code from server.
		$responseCode = wp_remote_retrieve_response_code( $response );
		if ( false === strstr( $responseCode, '200' ) ) {
			$responseMessage = wp_remote_retrieve_response_message( $response );
			$this->error = "{$responseCode} {$responseMessage}";
			return false;
		}

		// Check for nested status code not being successful.
		if ( isset( $this->response->status ) && 200 !== $this->response->status ) {
			$this->error = $this->response->result->data;
			return false;
		}

		return true;
	}
1009894
public function validateRequest(RequestInterface $request, ResponseInterface $response)
	{
		// check HTTP basic auth headers for client id/secret
		if (!is_null($request->headers('PHP_AUTH_USER')) && !is_null($request->headers('PHP_AUTH_PW')))
		{
			$clientData = array(
				'client_id'     => $request->headers('PHP_AUTH_USER'),
				'client_secret' => $request->headers('PHP_AUTH_PW')
			);
		}

		// if we allow credentials via request body look there
		if ($this->config['allow_credentials_in_request_body'])
		{
			// check for client id in request
			if (!is_null($request->request('client_id')))
			{
				$clientData = array(
					'client_id'     => $request->request('client_id'),
					'client_secret' => $request->request('client_secret')
				);
			}
		}

		// must have client id
		if (!isset($clientData['client_id']) || $clientData['client_id'] == '')
		{
			$message = $this->config['allow_credentials_in_request_body'] ? ' or body' : '';
			$response->setError(400, 'invalid_client', 'Client credentials were not found in the headers'.$message);
			return false;
		}

		// check to see if we have client secret
		if (!isset($clientData['client_secret']) || $clientData['client_secret'] == '')
		{
			// invalid if we dont have client secret and public clients are off
			if (!$this->config['allow_public_clients'])
			{
				$response->setError(400, 'invalid_client', 'client credentials are required');
				return false;
			}

			// check storage if client is public client
			if (!$this->storage->isPublicClient($clientData['client_id']))
			{
				$response->setError(400, 'invalid_client', 'This client is invalid or must authenticate using a client secret');
				return false;
			}
		}
		// if we do have a secret lets verify them
		elseif ($this->storage->checkClientCredentials($clientData['client_id'], $clientData['client_secret']) === false)
		{
			$response->setError(400, 'invalid_client', 'The client credentials are invalid');
			return false;
		}

		// store data locally
		$this->clientData = $clientData;
		return true;
	}
704165
private function isErroneousResponse($response)
    {
        return (isset($response->type) and isset($response->title) and isset($response->status) and isset($response->detail));
    }
677511
public static function isJsonError($response)
    {

        if(is_wp_error($response)) {
            return true; 
        }

        if ($decoded = json_decode($response)) {
            $response = (array) $decoded;
        }

        if (isset($response['error'])) {
            return true;
        }
        
        return false;
    }
285238
public function isBearer($response)
	{	
     	if (!isset($response->token_type)) {
    		return false;
    	}

    	if ($response->token_type == 'bearer') {
    		return $response->access_token;
    	}
	}
1244360
public function parse_tag_response( $response ) {
		if ( $this->validate_response( $response ) ) {
			return $response;
		}

		$arr = [];
		array_map(
			function ( $e ) use ( &$arr ) {
				$arr[] = $e->tag_name;

				return $arr;
			},
			(array) $response
		);

		return $arr;
	}
1311666
public function isAuthorise($response){
        $result = false;
        $hasError = $this->isError($response);
        $isApprove = $this->isApprove($response);

        if(!$hasError && $isApprove){
            $result = true;
        }

        return $result;
    }
271725
public function validate(): bool
    {
        if (! $this->requestIsValid()) {
            return false;
        }

        $requestOptions = $this->getDefaultRequestOptions();
        $customOptions = $this->getCustomRequestOptions();

        if (! empty($customOptions) && is_array($customOptions)) {
            $requestOptions = array_merge($requestOptions, $customOptions);
        }

        $response = $this->guzzleClient->request('POST', self::OPENID_URL, $requestOptions);

        $results = $this->parseResults($response->getBody()->getContents());

        $this->parseSteamID();
        $this->parseInfo();

        return $results->is_valid == 'true';
    }
297194
protected function getStatus(array $response)
    {
        $payments = Arr::get($response, 'payments');

        if (empty($payments)) {
            return new Status('pending');
        }

        $newResponse = $response;

        if (count($payments) > 1) {
            $totalPaid = 0;
            $totalRefund = 0;
            $total = $newResponse['shipping_cost'] + $newResponse['total_amount'];

            foreach ($payments as $payment) {
                if ($payment['status'] === 'approved') {
                    // Get the total paid amount, considering only approved incomings.
                    $totalPaid += $payment['total_paid_amount'] - $payment['amount_refunded'];
                } elseif ($payment['status'] === 'refunded') {
                    // Get the total refunded amount.
                    $totalRefund += $payment['amount_refunded'];
                }
            }

            if ($totalPaid >= $total) {
                $newResponse['status'] = 'approved';
            } elseif ($totalRefund >= $total) {
                $newResponse['status'] = 'refunded';
            } elseif ($totalRefund > 0) {
                $newResponse['status'] = 'partially_refunded';
            } else {
                $newResponse['status'] = 'pending';
            }

            return parent::getStatus($newResponse);
        }

        $newResponse['status'] = $payments[0]['amount_refunded'] > 0 ? 'partially_refunded' : $payments[0]['status'];

        return parent::getStatus($newResponse);
    }